#help-development

1 messages · Page 2109 of 1

noble lantern
#

in US you can do 800-api-call

#

even better

torn shuttle
#

ah

#

truly a more advanced country

noble lantern
#

ive seen some countries have phone numbes like 16 numbers long

torn shuttle
#

here it's 9

noble lantern
#

What country?

torn shuttle
#

🇵🇹

#

I don't think anything annoys me in java and oop in general more than the lack of ability to do multiple class inheritance

#

it's so lame

quaint mantle
torn shuttle
hybrid spoke
#

what is oop and inheritance

torn shuttle
small lynx
#

Why my mysql connection give a error Too many connections

torn shuttle
#

I think you might have Too many connections

small lynx
#

How i Fix that

torn shuttle
#

well presumably lower the amount of connections to mysql

hybrid spoke
#

yes, im in love everytime in look into the mirror

small lynx
#

Why my mysql connection give a error Too many connections

smoky oak
#

is there a way to continue a outer for loop from a twice nested inner one?

#

the fuck?

#

since when does that exist?

small lynx
#

The error shows up when the plugin initialize

#

How i can close

#

The old connections

sharp flare
#

Are optionals redundant on #getItemMeta

#

Also with #getLore()?

chrome beacon
#

It should only be null if item is air

sharp flare
#

So Optional#ofNullable ain't needed?

#

For example in a block break event

chrome beacon
#

You can use it if you want to be extra safe

#

But generally no you don't need it

sharp flare
#

I was about to use it for #getItemMeta and #getLore

#

Nasty NPE's

hybrid spoke
#

never throw an NPE yourself

spring minnow
#

Yeah just use the one that throws automatically at this point..

smoky oak
#
String key : configurationSection.getKeys(false)```
Does this iterate over the keys in the order they're in the config? IE
```yml
a:3
b:7
``` -> a, then b?
golden turret
#

yes

eternal night
#

yaml does not promise order in the key order

smoky oak
#

two people two answers bruh

eternal night
#

concerning that underlying is a hashmap when parsed into memory, you cannot expect order

#

if you need order, use a list

smoky oak
#

you mean, make a separate string list of the keys in the order to process them?

eternal night
#

no just, store your stuff in lists ?

#

idk why you'd need order in keys

golden turret
#

when i use getKeys

#

i see everything ordered

#

🤔

eternal oxide
#

Still just a Map so no guaranteed order

golden turret
#

which map

#

LinkedHashMap?

eternal oxide
#

the whole config

eternal night
#

oh right it is a linked hash map

#

depressing

#

anyway tho, the yaml format iirc does not promise it

#

there is lists for exactly that purpose

#

use them

smoky oak
#

it's not a huge issue, but has the potential to become one, hence the quesation. I need a guarantee that certain keys get proccessed last

eternal night
#

I mean, from the looks of it the LinkedHashMap should promise you that ?

#

tho again, a list would by far be the more yaml-like approach

#
myOrderedValues:
  - key: a
    value: 3
  - key: b
    value: 7
smoky oak
#

how the hell does that work

eternal night
#

huh ? that is a list in yaml ?

golden turret
smoky oak
#

i mean how do you parse that

#

is that key both a key and a string?

golden turret
eternal night
#

no those are just objects

#

yes spigot should just work with keys @golden turret you were right on the linked hash map

#

I am just saying that yaml in general does not

#

it is a nice implementation detail of spigot that you get your stuff in the order you define it in, but in the end it is a node tree

golden turret
#

i think it does if you read them line by line

eternal night
#

spigot yaml yes

#

any other yaml parser implementation on the planet ? probably not

smoky oak
#

bukkit?

eternal night
#

bukkit does not exist anymore

#

well

#

technically it does

#

but spigot maintains it

#

that is all that it is there for

#

who in their mind runs plain bukkit

golden turret
#

org.BUKKIT !!!!!!!!!!!!!!!!!!

eternal night
#

lol

golden turret
#

bukkit still exists!

smoky oak
#

welp question answered i guess

eternal night
#

as a base for spigot 😂

smoky oak
#

and noted that this only works in spigot

eternal night
#

so yea, you can just do that in order

#

👍

smoky oak
#

thanks for the detail

quaint mantle
#

Hi I am new

#

is spigotMC good for minecraft server?

#

have good performance?

#

and no crashing server?

eternal night
#

probably the wrong channel for this, you might want to ask in #help-server

#

this is for plugin development

quaint mantle
#

Ok

eternal night
#

one is the time of day, the other the general game time

#

e.g. what you see in your f3 like (day 34)

smoky oak
eternal night
#

I don't think it does ?

smoky oak
#

wait does this call continue on for(loop) or no

golden turret
#

that will break only the abc loop

#

the 1st loop will keep running

smoky oak
#

yea i know thta but does it do continue; on the outer loop

#

or do i need to do this if(cont){cont=false;continue;}

eternal night
#

it breaks out of the inner loop

desert tinsel
#

why do i have that error when i try to load my plugin which uses a h2 database:
No suitable driver found for, what driver do i need, and how to add it?

eternal night
#
for(loop) {
  abc: for(otherLoop) {
    break abc;
  }
  sout("HI")
}
quiet ice
#

It does Not continue as in continue but simply procceed as usual

eternal night
#

hi would be printed here

desert tinsel
#

yep

golden turret
#

wtf is it

#

you need the driver

desert tinsel
#

what driver

eternal night
desert tinsel
#

yep

golden turret
#

you can shade it

eternal night
#

pretty much ye

golden turret
#

or create a lib management plugin

#

orrr

#

if you are in 1.18

#

you can declare the dependency in plugin.yml

desert tinsel
#

hmm

eternal night
#

that feature existed prior to 1.18 did it not 🤔

#

1.16.5 iirc

golden turret
quiet ice
#

It existed for a while

eternal night
#

I mean, the feature still is far from fleshed out imo

#

it makes sense it is in preview

quiet ice
#

What would need Change there?

eternal night
#

third party repository support

#

the fact that this uses maven central is also eeek

#

maven centrals TOS might not be too happy with it

quiet ice
#

True

eternal night
#

as a dependency ?

#

Well generally, if you want others to do the same you would have to deploy it to a public maven repository

#

if you just need it locally, you mvn install the dependency

#

which installs it into your local maven repository

#

then you can define it as a dependency the same way you'd define any other dependeny

steel swan
#

hey so i have this code :

if (blockType == WHEAT_SEEDS){
            if (player.getGameMode() != GameMode.CREATIVE){
                if (getjobs(player) == Job.FERMIER) {
                    if (player.getInventory().getItemInHand().getType() == DIAMOND_HOE) {

                        Ageable ageable = (Ageable) event.getBlock().getState().getBlockData();
                        if (ageable.getAge() == 7) {
                            event.setCancelled(true);
                            ItemStack givenItem = new ItemStack(WHEAT, 1);
                            player.getInventory().addItem(givenItem);
                            event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation()).setType(WHEAT);

                            Bukkit.getScheduler().runTaskLater(this, () -> {
                                ageable.setAge(7);
                            }, 200L);

                        }else{
                            player.sendMessage("Eh Oh Attend la !");
                        }
                    }else{
                        event.setCancelled(true);
                        onError(player);
                    }
                } else {
                    event.setCancelled(true);
                    onError(player);
                }
            }
        }

But when i have all of what is required (the right job, right item in hand and everything) it breaks, just goes back as before and doesnt do anything (like it doesnt give me the wheat). Anyone knows why?

#

(ps : onError() just send an error message)

#

oh yeah sorry

#

@EventHandler
public void onBlockBroken(BlockBreakEvent event){

#

so what it does is

#

when u break it , if u have the required things ( the right job etc) u can , if its fully grown, break it. It should give u 1 wheat, replace the fully grown seed with a new seed, and then 10 sec later make it fully grown

eternal night
#

a) you can get the block data directly from the block, don't create a state snapshot for it

#

b) you have to feed back the mutated block data to the block using setBlockData iirc is the method name

steel swan
#

yep

steel swan
eternal night
#

after you setAge(7)

#

also event.getBlock().getWorld().getBlockAt(event.getBlock().getLocation())

#

like LOL

#

event.getBlock() is the block you want xD

#

getting that blocks world, to then get the block in that world at the location of the block you already have it well not optimal 😅

steel swan
#

OH YEAH LMAO

hybrid spoke
eternal night
#

Ya gotta triple check that xD

hybrid spoke
#

all good things are 3

steel swan
#

oh no

#

i just changed that

#

to change

#

its just seeds

#

Wheat*

#

Wheat*

elfin atlas
#

Question does someone know why I can't connect to Websocket in my plugin? So I created a Websocket with webbit for my Plugin to communicate with my audio client. the Problem is I can't connect to the socket does someone know if I have todo something to get it to work?

undone axleBOT
#

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

hybrid spoke
#

WHEAT

steel swan
#

WHEAT

golden turret
#

SORRY I WAS WORKING WITH ENUMS

steel swan
#

just Wheat

#

not seeds

#

just Wheat

#

seeds was to test smth

#

its just Wheat

elfin atlas
hybrid spoke
#

or has wrong settings

#

regarding timeouts

elfin atlas
#

I use webbit Idk if this is maybe not working together with a plugin but I saw it on a MC Plugin for the version 1.12 on github so I also tried to use it

smoky oak
#

is there a Chunk# method to check if its a slime chunk?

eternal night
smoky oak
#

thansk

#

does if(!statement) compile to the same bytecode as if(statement==false)? I'd use the second one because its more readable

#

k

eternal oxide
#

I use ! myself, but I have on occasion missed a ! in other peoples code so I read it wrong.

quaint mantle
#

! is way more readable and requires less typing :D

#

also hi elgar <3

eternal oxide
#

hi

smoky oak
#

may be true for primitives

#

i prefer if(allOneOrZero(iSet) == false) over if(!allOneOrZero(iSet))

smoky oak
#

okay what the fuck is this...

log("Key 0 in structureSection.getKeys() is: "+structureSection.getKeys(false).toArray()[0]);
  for(String key : structureSection.getKeys(false)){
    log("Handling key "+key);
    ...
  }
log("returnValue:"+value);

results in this output:

test
returnValue: NO_RESULT```
Can someone explain how grabbing the keys works in the log function and *doesn't* in the for loop?????
frosty echo
#

?paste help

undone axleBOT
smoky oak
#

i believe the code is short enough to post it here. Anyone here offering actual advice?

undone axleBOT
thick tundra
#

I want to know how to create inverse kinematics in java, anyone here that can help me?

crisp steeple
hybrid spoke
grand perch
#
            if(e.getCurrentItem().getItemMeta().equals(BlocksCategory.getItemMeta())) {
                categoryGui category = new categoryGui("Blocks");
                player.openInventory(category.getInventory());
                player.sendMessage("a");
            }

this never gets run

golden turret
#

item meta is different

grand perch
#

wat

#

i got BlocksCategory from the same ItemDatabase

#

how could it be diffrent?

late sonnet
# grand perch wat

what items are you checking?
you try debug what are the content for this itemmetas?

grand perch
#

how do i debug the content of meta

hybrid spoke
#

ItemStack#isSimilar

smoky oak
# crisp steeple doesn’t seem like it’s ever getting logged
log("Make sure the code is up-to-date; first key in structureSection is, by name, 'test'.");
log("Key 0 in structureSection.getKeys() is: "+structureSection.getKeys(false).toArray()[0]);
for(String key : structureSection.getKeys(false)){
     log("Handling key "+key);

Fairly sure it gets logged deo

#

wait why does it work now

grand perch
#

i serched it up i dont understand it

smoky oak
#

that damn dot... i always forget the separator urgh

smoky oak
#

how does .equals() work on arrays?

smoky oak
#

see thing is

eternal night
#

.equals on arrays has no special implementation

#

e.g. it defaults to Object#equals

#

which, is just this == other

#

yea

grand perch
smoky oak
#

welp custom implementation it is

eternal night
#

huh ?

#

why

#

Arrays.equals probably does what you want it to do

smoky oak
#

does this sound about right?

static boolean equals(HashMap<?,?>[] arrayA, HashMap<?,?>[] arrayB){
  if(arrayA.length!= arrayB.length) return false;
  for(int i=0; i<arrayA.length; i++){
    if(! arrayA[i].equals(arrayB[i])) return false;
  }
}
grand perch
#
            if(e.getCurrentItem().isSimilar(BlocksCategory)) {
                categoryGui category = new categoryGui("Blocks");
                player.openInventory(category.getInventory());
                player.sendMessage("a");
            }

its not sending a

opal juniper
opal juniper
smoky oak
#

welp null check time Cannot invoke "java.util.HashMap.equals(Object)" because "arrayA[i]" is null

opal juniper
opal juniper
grand perch
#

wat

#

wtf is a latter

smoky oak
#

oh thats what you mean

opal juniper
#

the latter means the last thing in a series of things. So maybe its just not similar

grand perch
#

yeah

#

is there another way to check what the user clicked?

opal juniper
#

I mean you have the itemstack of what they clicked, what more can you want

grand perch
#

no i want to redirect them to another inventory if a certail itemstack is clicked

#

my problem is when i click the itemstack (THAT HAS THE LITTERAL SAME ITEMS) its not running

#

and this is the moment i realize i could check the slot the user clicked in

#

IT DOESNT WORK

eternal oxide
#

then BlocksCategory is not a similar ItemStack or it is null

grand perch
#

also it cant be diffrent

eternal oxide
#

Its one of those two, or your Listener is not running

grand perch
#

in the inventory inv.setItem(10, BlocksCategory)

eternal oxide
#

Those are your only three options

grand perch
#

i think if (e.getClickedInventory().getHolder() instanceof mainShopGui) { is returning false

#

not sure why

eternal oxide
#

Well, you never showed any of that code so I can;t comment on it.

grand perch
#
public void onClick(InventoryClickEvent e) {
        e.getWhoClicked().sendMessage("a");
        if (e.getClickedInventory() == null) { return; }
        if (e.getClickedInventory().getHolder() instanceof mainShopGui) {
            e.setCancelled(true);
            Player player = (Player) e.getWhoClicked();
            player.sendMessage("aA");
            if (e.getCurrentItem() == null) { return; }

            if(e.getSlot() == 10) {
                categoryGui category = new categoryGui("Blocks");
                player.openInventory(category.getInventory());
                player.sendMessage("aB");
            } else if(e.getSlot() == 11) {
                categoryGui category = new categoryGui("Foods");
                player.openInventory(category.getInventory());
            } else if(e.getSlot() == 12) {
                categoryGui category = new categoryGui("Valuables");
                player.openInventory(category.getInventory());
            } else if(e.getSlot() == 13) {
                categoryGui category = new categoryGui("Pvp");
                player.openInventory(category.getInventory());
            } else if(e.getSlot() == 14) {
                categoryGui category = new categoryGui("Potion");
                player.openInventory(category.getInventory());
            } else if(e.getSlot() == 15) {
                categoryGui category = new categoryGui("Mob Drops");
                player.openInventory(category.getInventory());
            } else if(e.getSlot() == 16) {
                categoryGui category = new categoryGui("Spawners");
                player.openInventory(category.getInventory());
            }
        }
    }
opal juniper
#

(be careful ElgarL might steal it)

#

ew

#

nvm he wont

grand perch
grand perch
eternal oxide
#

do you see teh aA message?

grand perch
#

yes

#

wait

#

i havent tried this one

#

bcs i have to go in a minute

#

but

#

i tried the one after the null check

#

and it ran

eternal oxide
#

Thsi line will early exit if you have an empty hand if (e.getCurrentItem() == null) { return; }

grand perch
#
            if (e.getCurrentItem() == null) { return; }
            player.sendMessage("aA");

this was the debug code i used

eternal oxide
#

So not the code you just showed me.

grand perch
#

yeah i changed it a bit

eternal oxide
#

Then the only mistake you are doing is trying to open an inventory IN the InventoryClickEvent. It will not work, you have to delay it. It tells you so in teh Javadoc

grand perch
#

alr thx

#

i cant find how to

#

also i have to go

eternal oxide
#

?scheduling

undone axleBOT
gleaming grove
#

What algorytm use Mojang to hash skin to Texture value and Texture signature?

quiet ice
#

You might need to refer to Plugin Messaging Channels (https://wiki.vg has a link to spigots docs iirc)

gleaming grove
hasty prawn
#

You can ping Mojang's API to get the texture and signature strings.

gleaming grove
#

So I need to just take bytes from Texture image and put them into Base64 right?

hasty prawn
gleaming grove
#

my goal is to generate texture by myself and put it into NPC I hope that it possible

quiet ice
#

on which side is the event called?

#

Bukkit or Bungee?

#

?jd-s

undone axleBOT
hasty prawn
quiet ice
#

Considering that it is called very early it might have something to do with bungee having some strange behaviour. Idk

exotic depot
#

whats the most efficient way to do this? I want to make a system where I can easily create and destroy a armor stand and provide an item with a model which it will display, and when the player hits a raycast is made to see if they clicked it which would do something

gleaming grove
#

what amount of armorstand you assume to place?

exotic depot
#

like in the world? just around 5

#

basically im trying to show models for maps so you can click on them to vote for the map

hybrid spoke
#

packets

hasty prawn
#

why packets

hybrid spoke
#

why not

#

thats the most efficient way

hasty prawn
#

because he wants to detect when they click on them

hybrid spoke
#

and?

hasty prawn
#

and if the server doesn't even know they're there thats gonna be hard

hybrid spoke
#

still fires packetsided

hasty prawn
#

Does it? Thonk

hybrid spoke
#

yup

exotic depot
#

yeah

hasty prawn
#

I wouldn't go that route, definitely the API can achieve what you want to do.

exotic depot
#

but im gonna be using raycasts for a custom bounding box

hybrid spoke
exotic depot
#

so could I use packets and just store those locations? and then do raycasts like i wanted

hasty prawn
#

Sometimes it's worth trading efficiency for support and ease of use lol

hybrid spoke
exotic depot
#

i want a bigger hitbox for it

#

because the model will be big

hybrid spoke
#

if you have a custom bounding box the armorstands doesnt really matter anyways

exotic depot
#

wym

hybrid spoke
#

the box is apart from the armorstand just at the same location or not?

exotic depot
#

yeah

#

im just using the armorstand as a way to render the model

hybrid spoke
#

so the armorstand do nothing but visualizing that there is something you could interact with

exotic depot
#

yeah

gleaming grove
hybrid spoke
#

yeah well packets and real entities probably doesnt take much from each other in this case

exotic depot
#

would real entities be easier?

hybrid spoke
#

depends on your skilllevel

#

averagly said yes

exotic depot
hybrid spoke
#

at least its less afford

gleaming grove
#

ye I'm my case there was needed 91 Armor stands to create one Model fully

exotic depot
#

damnnn and that doesnt cause much lag?

#

im new to spigot dev ive mostly done bedrock stuff and client starts lagging when theres like 30 entities lol

chrome beacon
#

Bedrock is quite bad ngl

hybrid spoke
#

java>>

#

i mean

#

it would prob. crash someone with 512mb ram

manic delta
#

how can i make a custom player_head?

#

1.18.2

chrome beacon
manic delta
#

I was searching and i only found for old versions

hybrid spoke
chrome beacon
#

True

manic delta
#

someone knows ? 😿

gleaming grove
serene egret
#

when i compile my plugin, my changes do not save, how to i fix this?

eternal night
#

Make sure your IDE actually saved the file ?

#

besides that both maven and gradle should invalidate the correct caches if needed

small current
#

and do you reload the plugin using a third party plugin or restart

#

cause i had this problem in 1.18.1 and i had to restart

gleaming grove
serene egret
small current
serene egret
#

eclipse

eternal night
#

(how are you compiling)

gleaming grove
#

maybe you can not overrite your plugin file because plugin is running in spigot

serene egret
#

i do

small current
serene egret
#

i tried to completly get rif of any traces of my plugin from that server

dusty herald
#

i havent touched eclipse in many year

tardy delta
#

good

dusty herald
#

time to open it

serene egret
dusty herald
#

oo i get to set a workplace

tardy delta
#

i only used eclipse in the beginning

dusty herald
#

how neat

tardy delta
#

-<

dusty herald
#

ok what the fuck is this?

eternal night
#

average spigot plugin 🤔

serene egret
dusty herald
#

you sure? it's pretty complicated

#

meaning you'd probably have to look at tutorials on how to compile using maven

dusty herald
#

i forgot how eclipse compiles by default

eternal night
#

specify what ?

#

i have no idea how eclipse compiles 😅

#

both mvn package or gradle build should properly invalidate caches

#

if you are not using a build tool, may the coding gods have mercy on you

tall furnace
serene egret
#

alr

quiet ice
#

Eclipse is nice

#

... provided you know what you are doing

smoky oak
#

HA
No.

quiet ice
#

Like IntelliJ is nice and all but I cannot imagine moving 100% to it due to how my workflow behaves - that being said you will have to know how to use two IDEs considering that using kotlin with eclipse is a fool's errand

smoky oak
#

well tbh the main reasons i dont use eclipse is that the ui is broken on my screen since its so bright and im too used to not saving shit

quiet ice
#

I spam the save button subconsiously. But eclipse has an auto-save feature (though it only actives after you don't edit something for a given time)

zenith saddle
#

I started coding plugins around a day ago, and was wondering how to spawn a primed tnt at players location?

smoky oak
#

world.spawnEntity(loction, EntityType.PRIMED_TNT) i presume

zenith saddle
#

Ahhh Entity.type

#

Thats what I was missing tx

smoky oak
#

use a ide? I typed in world.spawn and it showed me everything

zenith saddle
#

ok

mighty pier
#

im making kits and i want to get the time the player tried to execute /kit <kitname> - when the player claimed the kit and see if cooldown is >= to the kit delay, how do i get the time?

smoky oak
#

well you can use System.getMilis i guess

mighty pier
#

what does that return

smoky oak
#

dependent on how long the cd is you would need to store the last use too

#

how many milliseconds since january 1970

mighty pier
#

ok

zenith saddle
smoky oak
#

doesnt that method spit out the entity you spawn?

#

use that

zenith saddle
#

But If I wanted to change fuse duration and velocity then what do I do?

smoky oak
#

cast it to TNTPrimed

zenith saddle
#

Sorry I am new what does that mean, all I have so far is:

#

Player p = event.getPlayer();

p.getWorld().spawnEntity(p.getLocation(), EntityType.PRIMED_TNT);

feral socket
#

it returns the Entity, cast it.

supple elk
#

is there a better way of doing this?

#

I'm loading a world asynchronously then want to unload the world once it's loaded

smoky oak
#

TNTPrimed tntInstance = (TNTPrimed) p.getWorld().spawnEntity(p.getLocation(), EntityType.PRIMED_TNT);
this creates a TNTPrimed instance, World#spawnEntity returns an entity. That entity is a TNTPrimed entity, but the method returns the parent class Entity, hence why you cast it with (TNTPrimed) to get a tntInstance.
That instance you can modify for example to change how long it takes until it explodes

supple elk
#

the loadworld function

supple elk
#

nvm my thing doesn't work anyway

#

I was told yesterday worlds could be created async 🤔

feral socket
#

and you've made the mistake of believing everybody here

tardy delta
#

why would you create a world async?

supple elk
#

so it doesn't block main thread

tardy delta
#

when do you create it?

supple elk
#

I'm making minigames

#

every time a new minigame starts I'll be cloning then loading a world

kind hatch
#

I think you can only load worlds async with paper. They have some weird stuff going on over there when it comes to optimizing worlds and how they load.

supple elk
#

so it could be pretty frequent

supple elk
#

maybe those who told me they could be loaded async were thinking of paper

tardy delta
#

most of the time, doing api stuff async isnt working

supple elk
#

no way around the loading times then

feral socket
#

paper doesn't have asynchronous world loading either, only chunks

#

however, if the world has spawn chunks off, it will load very quickly because it doesn't need to load that huge area into memory

quaint mantle
#

hi i have a problem

supple elk
#

then what were the people talking to me yesterday thinking >_>

tardy delta
#

?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

quaint mantle
#

i'm creating a plugin and i have one else

#

oh

feral socket
#

in terms of cloning an existing world, you might as well just do the copying of files yourself

feral socket
#

as long as spawn chunks are off in that world, it should be pretty quick to load

supple elk
#

right

#

what's the advantage of having spawn chunks on?

feral socket
#

vanilla behavior

supple elk
#

kk

#

but if I'm doing minigames that's pretty pointless right

chrome beacon
#

Yes

feral socket
#

especially with paper it would be beneficial to load them async, not when loading the world

supple elk
#

right

#

it'll prob be fine without spawn chunks then

quaint mantle
#

?ask Hello, I'm creating a plugin and right now I'm creating the fly command. I've already created it and I've made it require a permission, but when I put the else to make it send a message to the player, it tells me else without if.

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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

tardy delta
#

lol

quaint mantle
#

Hello, I'm creating a plugin and right now I'm creating the fly command. I've already created it and I've made it require a permission, but when I put the else to make it send a message to the player, it tells me else without if.

tardy delta
#

?paste your code

undone axleBOT
quaint mantle
#

ok

#

?paste

undone axleBOT
tardy delta
#

man thinking we communicate by command here :kek:

supple elk
#

how do I disable spawn chunks?

quaint mantle
#

ok i pasted this

#

there's my code

feral socket
#

eciraboner, huh?

supple elk
#

'eciraboner'

quaint mantle
#

xd

supple elk
#

lmao

quaint mantle
#

i don't create the link

tardy delta
#

i wouldnt do the registering in the constructor anyways

feral socket
#

you have two else statements

quaint mantle
#

automatically

#

?

#

me?

#

yes

#

i have 2

feral socket
#

no, the other person that just shared their code

quaint mantle
#

oh

#

ok

feral socket
quaint mantle
#

ii have this issue

#

i can't add another else

#

he tells else without if

#

any person to help me?

tardy delta
#

youre allowing the player to fly even when they dont have permission

quaint mantle
#

there's my code

feral socket
#

you have two elses

quaint mantle
#

yes

feral socket
#

each else needs its own if

quaint mantle
#

i have two

feral socket
#

you have one if

#

two elses

tardy delta
#

and no clue why youre using p.isFlying() without using the returned value

#

logic is a bit weird

quaint mantle
#

oh

#

thanks

#

so

kind hatch
#

Firstly. You can’t do that they way you do. If you want to branch even further, you need an if else chain.

Secondly you might want to ?learnjava

feral socket
#
if (player.hasPermission()) {
} else if (player.isFlying()) {
} else {
}
quaint mantle
#

can you send me the corrected code?

#

please

feral socket
#

absolutely not

quaint mantle
#

ok

quaint mantle
#

any person can send me the corrected code please?

supple elk
#

no

echo basalt
#

🥣

supple elk
#

you write your own code

feral socket
#

i already did, lol

tardy delta
#

you might want to send a message to the player if they dont have permission and do an early return true

quaint mantle
#

ok

#

so one moment

echo basalt
#

returns aren't scheduled

#

no such thing as early or late

feral socket
#

keep-spawn-loaded in paper.yml, Jet. not sure if it's possible in spigot

kind hatch
#

I think he meant early exit.

quaint mantle
kind hatch
#

Like exiting of the method

tardy delta
quaint mantle
#

any person can tell me if is corrected the code?

tardy delta
#

early return

echo basalt
#

man's got an appointment to return

feral socket
#

you haven't changed anything of importance

quaint mantle
#

oops

#

no

#

i changed a littel bit of code

feral socket
#

and yet you still have unbalanced elses

quaint mantle
#

how can i fix it?

feral socket
#

think for more than five seconds.

tardy delta
#

you usually do an early return when a condition isnt met, f.e. no permission

supple elk
#

How do I disable the loading of the spawn chunks?

feral socket
#

i already answered you, Jet.

#

scroll up.

supple elk
#

oh sorry

#

didn't see

#

mb

supple elk
#

found this which I'll now test

#

I'm not sure if that will trigger after it's already loaded them in though

feral socket
#

the issue there is that it will load them first

supple elk
#

yeah

#

is there an event?

feral socket
#

which is why i was saying you need to copy the folder of a world that already has spawn chunks off and then load it

#

hi Elgar, long time no see

feral socket
#

don't create a new world

#

that will be inevitably slow

supple elk
#

well this is the intial creation

#

this is the world which will be edited when making a map

#

then subsequent worlds will clone that

feral socket
#

then yeah, that's fine

#

exactly how you'd do it; just make sure the world is unloaded when you're copying the directory

supple elk
#

yeah ofc

#

otherwise there's session lock

quaint mantle
#

this doesn't work

kind hatch
#

?notworking

undone axleBOT
#

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

feral socket
#

that's new.

tardy delta
#

whats new

quaint mantle
feral socket
#

i've given you the answer, why haven't you implemented it?

kind hatch
#

The issue is the double else statements

quaint mantle
#

Yes you helped me but I don't know where the error is

feral socket
kind hatch
#

???

feral socket
#

you don't have this, why do you expect it to work?

quaint mantle
feral socket
#

think about it logically

#

if else has two cases

#

yet you have three

supple elk
#

I just tried this

#

both times it loaded spawn chunks 🤔

lavish hemlock
#

Ah yes because the language can magically detect what you mean when you do two else branches in the same chain.

kind hatch
#

It’s a really good language. :3

feral socket
#

if only discord had some sort of age minimum, like 13

kind hatch
#

Oh wait…

lavish hemlock
#

I assume that's sarcasm

supple elk
#

cause if it was stored as a property of the world I would have expected it not to load the chunks second time

feral socket
#

does it make a difference if you load instead of create?

quiet ice
#

I'm new to the convo, what are you trying to do @feral socket ?

quaint mantle
#

so serei

#

sergei

#

the problem is solved like this?

feral socket
tardy delta
#

hmm my cat licking me

quaint mantle
#

i implement your answer

quiet ice
lavish hemlock
#

Actually you didn't

#

Oh

#

Now you did

pliant oyster
#

yo what's good

tardy delta
#

boo

pliant oyster
#

fr

supple elk
tardy delta
#

not creatin the files?

supple elk
#

it shouldn't be creating the files anyway

feral socket
#

i guess there's no specific method for it; try setting keep-spawn-loaded to false in paper.yml

supple elk
#

I'm on spigot

feral socket
#

that would be your first mistake

supple elk
#

lmao

chrome beacon
#

Second mistake not using Minestom :)

supple elk
#

how hard is it to switch to paper?

chrome beacon
#

No changes needed

#

Swap jar and you're good to go

supple elk
#

just in the server folder?

chrome beacon
#

Yes

supple elk
#

no dependency changes?

chrome beacon
#

Nothing needed

feral socket
#

backwards compatible

supple elk
#

doppee

#

ok ima switch

chrome beacon
#

Though Paper has some good api additions

feral socket
#

if you're not going to publish the plugin on spigot, use the paper api

supple elk
#

that means changing dependencies >_>

lavish hemlock
#

Well you don't have to

#

It's just that Paper's API is superior :3

#

Although not compatible with Spigot

#

So basically you'll only ever use it for private projects :p

supple elk
#

it's different

lavish hemlock
#

God, why do you use the server GUI?

kind hatch
#

Imagine not using the -nogui flag

eternal night
lavish hemlock
#

And then Sergei was ratelimited

eternal night
#

lol

feral socket
#

for adding reactions?

lavish hemlock
#

Well ye, Discord ratelimits reaction spam lol

supple elk
lavish hemlock
#

But it's awful

feral socket
#

and internet explorer is the default browser

kind hatch
#

Not anymore

supple elk
#

not a fan of this

lavish hemlock
#

I mean like, it's useable, but nobody uses it because it ends up actually costing additional resources for no benefit

supple elk
#

not letting me reload >_>

feral socket
#

/reload confirm

lavish hemlock
#

Read the rest of the message

tardy delta
#

microsoft edge uwu

supple elk
#

a

lavish hemlock
#

You have to track down the exe.

feral socket
#

glad i quit windows

tardy delta
#

same

lavish hemlock
#

The lil help button in the top right corner of File Explorer opens Internet Explorer tho lol

#

Oh nvm

#

Now it uses Edge

#

I continue to not understand why anyone would use Edge

eternal night
#

it is chromium based 🤔

lavish hemlock
#

I like Chromium, for the record

tardy delta
#

firefox for the win

lavish hemlock
#

I don't like Chrome

#

But I like Chromium, it's easy to use

eternal night
#

ya gotta be brave maow

tardy delta
#

i tried to use chromium but the fonts seem to bug

lavish hemlock
#

I just use Ungoogled Chromium bc fuck Google lol

lavish hemlock
#

But I like how it's not bloaty or slow

#

Note: Do not use Chromium's default password management, it's all plaintext shit iirc

lavish hemlock
#

There's some instructions on Windows but they actually poorly explain the process

fallen thunder
#

Hello everyone I tray to publish package on github with gradle but it no work

serene egret
#

Caused by: java.lang.UnsupportedClassVersionError: com/bannasoftware/bannacore/Main has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

#

how do i change the compiler to use an older runtime

river oracle
#

You need to change your jdk path to the correct version

zenith saddle
river oracle
#

That means the item you are giving is null you are abusing a static pattern don't abuse static have broomstick return itemstack

zenith saddle
#

?

river oracle
#

Bad habits like static abuse makes code buggy and not easy maintainable

#

Learn how to use static properly

tardy delta
#

?static

#

meh i thought there was a post written by choco

smoky oak
#

its a post by mfnalex

#

hell if i know where

fallen thunder
# eternal night https://docs.github.com/en/packages/working-with-a-github-packages-registry/work...
A problem was found with the configuration of task ':publishGprPublicationToGitHubPackagesRepository' (type 'PublishToMavenRepository').
  - In plugin 'org.gradle.maven-publish' type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository' property 'credentials.username' doesn't have a configured value.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
#

I have this problem

fallen thunder
#
publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/zuhowks/asilux-api")
            credentials {
                username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USERNAME")
                password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
    publications {
        gpr(MavenPublication) {
            groupId = 'zuhowks'
            artifactId = 'asiluxapi'
            version = '1.0-SNAPSHOT'

            from(components.java)
        }
    }
}
#

This is my publishing methode

#

and I store my username and my token in gralde.propertie

#
gpr.user=ZUHOWKS
gpr.key="my_personal_token"
tardy delta
#

gradle makes some weird errors

fallen thunder
#

no np I use gradle since a moment and I love Kotlin is grate but I use too much gradle for modding

zenith saddle
#

Is there a better way to do what I am doing?

green prism
#

Hey guys, I got a problem with PlaceholderAPI.
I made a custom name maker that shows the name into %identity_name%.
There's a command that kick the player if he want to change his name and clear relative informations from the config... The only one problem is that the PlaceHolder isn't updated after the change... Who can help me?

eternal night
#

NMS basically ?

#

don't think that was exposed at all back then

maiden thicket
#

1.8 🥲

smoky oak
# zenith saddle I started programing java around 18 hrs ago. So which object that is static shou...

well my rule of thumb is: if its a function that is accessed by other classes, or your class is for some reason not instanticed in any way, make it static, otherwise, dont.
Good examples for static methods are parsers and math functions - they shouldnt be objects.
Something like setPosition should not be static and take in a Entity to modify (and isnt), but rather a function of that object, since it changes that objet. Functions like vector math, that change the vector they're applied to, arent static either.

#

take note that you almost always call some methods of those objects, but in most cases, you want them to be methods of that object, and not static methods

quaint mantle
#

How can I check if an entity is moving? If the entity is moving, a simple boolean variable is set to true, if not, it's going to be set to false.

echo basalt
echo basalt
#

otherwise you can use bkcommonlib's EntityMoveEvent

quaint mantle
#

I think I'll take a look into that

#

How do you check if the entity is moving or not though?

#

The event only triggers when the entity moves, correct?

ornate patio
#

is there a tutorial somewhere showing how to make an entity pathfind to a specific location using nms?

mortal hare
#

i've used this type of notation a lot

echo basalt
#

with Paper there's a Mob#getPathfinder

#

with NMS just cast it to EntityInsentient, look for the method that returns NavigationAbstract and call one of the a methods

quiet ice
ornate patio
echo basalt
# ornate patio a visual example would be helpful lol
private void makeEntityWalkTo(LivingEntity entity, Location target) {
  BlockPosition blockPosition = new BlockPosition(target.getX(), target.getY(), target.getZ());
  EntityInsentient insentient = (EntityInsentient) ((CraftEntity) entity).getHandle();

  insentient.D().a(blockPosition, 1f);
}
#

done from memory, correct me if I'm wrong

smoky oak
#

again im so fucking glad i use remapped. now theres capital letters too bruh

echo basalt
#

:)

tardy delta
#

mindfuck

ornate patio
#

why do these method names make no sense

smoky oak
#

wait whats the import for EntityInsentient

ornate patio
#

wtf is .D().a()

smoky oak
#

obfuscated code so we cant 'steal' it

echo basalt
#

all the a methods make it move somewhere

#

so I just call one of them

tardy delta
#

there was a time i believed that mojang actually wrote its code like that

#

😳

ornate patio
#

alright thanks

echo basalt
ornate patio
#

and is there a method to make an entity pathfind to another entity?

smoky oak
#

oh wait i forgot to enable the import and plugin

#

my bad

ornate patio
#

or do i just use the location of the other entity

echo basalt
#

a(EntityLiving)

smoky oak
#

um

ornate patio
echo basalt
#

should do

#

it's the equivalent of setTarget

smoky oak
#

is it EntityInsentient#a or EntityInsentient#D.a

echo basalt
#

can't guarantee it will work for passive mobs but should

ornate patio
#

like if the other enttiy moves while the entity is pathfinding to it

#

alright

#

and uh one more thing

echo basalt
ornate patio
#

how do i cancel the pathfinding

echo basalt
ornate patio
#

alright

#

ty

smoky oak
#

i did reload my maven with the spigot import

echo basalt
#

doing it for 1.18.1

smoky oak
#

?????

echo basalt
#

you need to import spigot, not spigot-api

smoky oak
#

im on 1.18.2

#

yea

#

i did that

#

hence my confusion

echo basalt
#

should be the same above 1.17.1

#

also you did run buildtools right?

smoky oak
#

yea

#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>

#

it did work with nms code before

#

something something setting 2 million blocks per tick something something

knotty gale
#

how do I make a cool down on a command?

smoky oak
tardy delta
#

best thing is to store the uuid and the last millis they used the command

knotty gale
#

ok

tardy delta
#

i kinda fucked it up in my code :D

smoky oak
#

hey fourteen do you know why my nms isnt working?

knotty gale
#

also how do I make a luckperms permission for my command, instead of using .isOp()

tardy delta
knotty gale
#

. how

smoky oak
#

no i meant the import aint working

tardy delta
#

still..

smoky oak
#

but i do have the maven stuff like its on md_5's post

knotty gale
#

what the event for an entity picking up an item that isnt depricated

#

i did

#

and the shit wont work

noble lantern
#

its EntityPickupItemEvent

knotty gale
#

if (player.hasPermission("Hello.use")) {

#

yeah

tardy delta
knotty gale
#

yk what nvm on the questions

#

im good now

#

i was using a different method

#

chill tf out

noble lantern
knotty gale
#

i wasnt

tardy delta
#

wait i think luckperms uses the Player#hasPermission stuff too

knotty gale
#

I accidently used PlayerPickupItemEvent

noble lantern
#

personally i prefer vault for checking permissions

knotty gale
#

ik

#

but you taking it too seriously

noble lantern
#

Unless i need to check something directly from luckperms like groups

knotty gale
#

ik its not fucking deprecated i just didnt know that was the method

#

others are

noble lantern
#

tbf desc does say serious

knotty gale
#

k... 💀

noble lantern
#

they always broke for me every so often using that method

#

is that a libary or something

tardy delta
#

thats an interface that player implements

noble lantern
#

oh

#

interesting

tardy delta
#

and there we got conclure

noble lantern
#

time to add a @HasPermission annotation now

ivory sleet
#

I mean LuckPerms is nice as they have a tri state return compared to the bukkit api and vault api iirc

noble lantern
#

ill have to look into that

tardy delta
#

luckperms was nice to get the groups prefix from

noble lantern
#

That's gotta be bots right?

opal juniper
#

not necessarily, but weird

#

no lol

tardy delta
#

no

noble lantern
#

oh you were serious about that lmao

#

thought you were just joking

tardy delta
#

entity doesnt implement permissable

#

lol

#

do they?

opal juniper
#

?stash

undone axleBOT
tardy delta
#

aight they do

noble lantern
tardy delta
#

if cow.hasPermission("bukkit.ban") 🤔

noble lantern
#

cows need to donate for that permission

opal juniper
#

fuck me sideways

#

who thought that was a good idea

noble lantern
#

thats awesome wym

tardy delta
#

!donate

#

aight

night copper
#

merge(Entity.COW, Player)
you get your cybervully

#

don't care

tardy delta
#

you too

#

zacken02.addAttachment(plugin, "eat", false)

#

now you cant longer eat >->

#

indeed

noble lantern
#

minecraft server but you need VIP to eat

opal juniper
#

oh ew, its cause:
Cow extends Animals
Animals extends Ageable
Ageable extends Creature
Creature extends LivingEntity
LivingEntity extends Entity
Entity extends CommandSender
CommandSender extends Permissible

So yes, a cow can have a permission

noble lantern
#

class inheritance go brrrrt

tardy delta
#

Entity implements Permissible smh

opal juniper
#

does it

smoky oak
#

okay time to ask.
I:

  1. Added the dependency & shading plugin https://paste.md-5.net/caturibiji.xml
  2. Recompiled with the flag -remapped
  3. Restarted my IDE
    and its still not showing me the NMS imports. The only import in the project is something in .m2/repo/com/github/oshi..., and at this point i just want to know how i can get nms to work again...
tardy delta
#

i thought

opal juniper
#

nope

#

i was right

#

get fucked

tardy delta
#

aight its a superinterface

#

still counts

#

stfu you dont have eatin right

sterile token
#

Is there any ORM or api that allow to treats (tables and rows from mysql and collections and documents from mongo) into 1 thing so then using the same "parser" you can either use mongo, mysql or sqlite

ivory sleet
#

ehm

#

hibernate

dusk flicker
#

you could just, write it yourself

ivory sleet
#

actually

dusk flicker
#

not gonna be that difficult

ivory sleet
#

dk if it accounts for mongo

#

but definitely the sql dialects

sterile token
#

I know that i can write my own but i think it will be a completly memory leak

#

😂

tardy delta
#

always fun

sterile token
#

But i can do a base and then do it open source, so other people get interest and try to help - Maybe

tardy delta
#

hmmmy

dusk flicker
#

you shouldn't really have to store anything in memory other than whatever object you are trying to put into the db

smoky oak
#

@echo basalt your import isnt working but every other import is...

tardy delta
#

renamed?

noble lantern
#

its likely under a different name

#

theres a website to see remapped names

#

i dont remember it

smoky oak
#

i know that but i also dont remember the name bruh

noble lantern
#

if i knew the link to the website, you could search that and it would show the remapped name

sterile token
ivory sleet
#

probably not

#

but like, it may come off as quite insightful

sterile token
#

Because sometimes you want to use an ORM but its really lazy to every time be changing code to use either sql or Nosql

smoky oak
#

wait
does -remapped spit out mojang or spigot remappings?

ivory sleet
#

mye, well you probably in code wanna make sure the rest of your database doesn't know about your io device implementation, so make an abstraction for that

#

mojmaps

sterile token
#

Allright thanks for recommendation

smoky oak
#

wait how do i get the spigot maps then and what's the maven import for those?

ivory sleet
#

take luckperms for instance, they have a StorageImplementation interface offering methods such as saveUser loadUser which does not expose anything about a database at all

sterile token
#

Whats your opinion?

ivory sleet
#

yes

#

reflection + annots, sometimes reflections, and yeah java assist

sterile token
#

Java assists its for working with bytecode?

ivory sleet
#

and sometimes the java annot process api

#

yes

#

its pretty much bytecode manipulation

#

if you can, avoid it

sterile token
#

Allr

#

I read that reflections sometimes are bad

ivory sleet
#

reflection or reflections?

sterile token
#

Because they consume lot of resources

ivory sleet
#

who told you that?

sterile token
#

I have been reading

ivory sleet
#

what articles?

sterile token
#

Like you cannot abuse over reflections

ivory sleet
#

do you mean reflection or reflections

sterile token
#

Isnt the same?¡

ivory sleet
#

(first one is the api (from the java standard library), latter is a lib)

worldly ingot
#

Lookups are expensive but if you're caching your reflective lookups, you're fine

zenith saddle
#

Can you add fractions of enchantments

sterile token
worldly ingot
#

No. Levels are shorts

sterile token
#

But i was reading about the one from java that you cannot abuse the usage

knotty gale
#

anyone how to check if a projectile has touched a block? and check if it is a specific type of block?

ivory sleet
#

cannot abuse?

sterile token
#

Also do you have the luckperms thing you mention

sterile token
ivory sleet
#

well

sterile token
#

Im not sure, i just read

ivory sleet
#

nah not inherently, thats the programmers fault then pretty much

sterile token
#

Remember in just 15, so all im doing its experiment

ivory sleet
#

I mean you can say even a hashmap can cause a memory leak, but thats usually due to bad choice of key implementation then

sterile token
#

So in fact i will try to make the ORM, also be greathfull if you can provide the part of database abstraction that you make reference on luckperms

ivory sleet
#

sure

sterile token
#

Because Luckperms github its huge

#

Its contains many modules

sterile token
#

Oh ok

zenith saddle
#

Is there a way to change block hardness?

dusk flicker
#

should work on newer vers just that thread is old-ish

ivory sleet
#

no worries

#

I mean LuckPerms isn't perfect, but its amongst the plugins with a clean design

sterile token
#

I think that Litebans its from the same author

ivory sleet
#

no?

dusk flicker
#

no

sterile token
#

Because their database design looks the same

dusk flicker
#

bans is by Ruan

#

Luck is by, Luck (or technically lucko)

ivory sleet
#

^ Luck would never go premium... lol

dusk flicker
#

I do admit I like Litebans a lot

ivory sleet
#

but yeah verano

#

they do a bit

grim ice
#

a

#

any topics i can learn

ivory sleet
#

however, most clean designs steer towards something like that

grim ice
#

to progress

dusk flicker
#

like if it was open source I would 110% be using it fully

ivory sleet
#

where every io device resource has an abstraction over it

ivory sleet
#

it makes the code base testable and more robust

sterile token
#

I will admit i have think to pay lot of money for a good man to decompile and deobfuscate

ivory sleet
#

why

#

there are other plugin sources that are better, which you can read for free

ivory sleet
#

if it regards Java

grim ice
#

Alright

ivory sleet
#

or well

#

method handles

#

(if you dont wanna do mixins)

sterile token
ivory sleet
#

its a bytecode manipulation library with an annotation api

grim ice
#

In object-oriented programming languages, a mixin (or mix-in) is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. Mixins are sometimes described as being "included" rather than "inherited".
Mixi...

#

ive heard bout it in forge api

ivory sleet
#

oh not that pattern

#

but rather

#

yes its a library

#

but its heavily used in forge and fabric

sterile token
#

Conclure any pattern i ill need for an ORm?

#

I just know Singleton, DI and Builder

ivory sleet
#

well

#

I mean you probably use a lot of other patterns unknowingly

sterile token
#

Allright thanks

#

I like this community

#

Lot of people try to always help and give recommendations

ivory sleet