#help-development

1 messages Β· Page 625 of 1

livid dove
#

Have you ever actually looked at Material?

quaint mantle
#
Something[] nativeArray = /*your array*/

for (int i = 10; i < nativeArray.length; i++) {
  Something smth = nativeArray[i];
}
mortal hare
#

Array.copyOfRange() returns copy of the array from the specified range what i need in my case is something like List.of(array) but with an argument that allows me to make a list view starting the specified position

river oracle
#

wdym by collection view

mortal hare
#

Wrapping array inside some kind of collection

#

or list (that would make more sense)

river oracle
#

so like List<String[]>?

mortal hare
#

but starting from the specified position

river oracle
#

or just a list implementation using arrays

quaint mantle
#

I think he wants to wrap an array into a list, but taking the elements from <index> to <array size>

#

You can't without creating a list object and iterating through the array

river oracle
#

hmmm idk of any libs that do, this unfortunately sowwy uwu

mortal hare
#

basically something like Arrays.asList() but with a separate argument

#

to specify from which index to make it wrapped

quaint mantle
#

Arrays doesn't have a "listOf" method

mortal hare
#

edited

quaint mantle
#

You must create a clone of the array

#

A "copy" from range

#

There's no other way

hazy parrot
#

would List.of(array).subList(x, array.length) be good

river oracle
#

I mean if you don't wanna make copies Unsafe is the way to go though

#

you get the memory locations of the elements of the list you wanna 'copy' and transfer them over

mortal hare
#

.sublist() seems what i need

#

but how can i create list backed by the same array

#

without copying

river oracle
# mortal hare without copying

you'll need unsafe as I said earlier, java loves copying and making references. So how do you not get it to do that? Do it manually and ensure it doesn't happen

quaint mantle
#

Why don't you want to create a copy if I'm allowed to ask?

young knoll
#

Muh cpu cycles

river oracle
young knoll
#

Oi mate why don’t ya just program in binary

quaint mantle
#

I program in HEX

#

It's shorter than binary and better

mortal hare
#

wouldnt Arrays.asList() create backed array list?

#

i dont need unsafe it seems

hazy parrot
#

yeah, according to docs it would

#

not sure how would .sublist behave on that

quaint mantle
#

Or you could create your own implementation that works over the original array using an offset

mortal hare
#

^

livid dove
river oracle
#

why do you need this specific behavior?

lavish cliff
#

Guys how i can manage Vault without using another plugin for it?

livid dove
young knoll
#

Vault is just an api

#

You need another plugin to provide an economy

lavish cliff
young knoll
#

Then you need to look into implementing vault

mortal hare
lavish cliff
livid dove
mortal hare
#

πŸ˜‚

livid dove
#

Should work for literally any type of array

#

As long as u dont goof and put a different type parameter in the List<T> bit

livid dove
mortal hare
#

lmao

livid dove
#

....

mortal hare
#

intellij doesnt detect built in types

mortal hare
livid dove
mortal hare
#

i found using Arrays.asList().toSublist() works better since it doesnt involve copying the array elements in any shape or form

livid dove
#

Erm... toSublist?

livid dove
hazy parrot
#

its just .sublist(x,y)

mortal hare
#

sorry

#

yea its sublist

inner mulch
#

public static boolean isInt(String s) { try { Double.parseDouble(s); } catch (NumberFormatException nfe) { return false; } return true; }
why does this not properly identify doubles?

eternal oxide
#

method name is wrong, but an int can parse as a double

inner mulch
#

my brain stopped while naming it apparently, but this doesnt work when i enter strings as well

eternal oxide
#

what are you using as a string?

inner mulch
#

player args[]

#

what the player says after command

livid dove
eternal oxide
#

what arg specifically are you expecting to parse as a Double?

inner mulch
#

args[1]
/example example this

eternal oxide
#

example is not a Double

#

this is also not a double

inner mulch
#

?

livid dove
#

my brother in christ he was giving an EXAMPLE

#

like "this is where my double will be "

inner mulch
#

yes

livid dove
quaint mantle
#

How are you writing your double? Using a coma, or a dot?

inner mulch
#

why not, as long as you are not stealing my account

livid dove
#
public static boolean isInt(String s) {
        try {
            Double.parseDouble(s);
        } catch (NumberFormatException nfe) {
            return false;
        }
        return true;
    }```
inner mulch
quaint mantle
#

If you are writing a double using "," instead of ".", it won't work and will always return false

inner mulch
#

im entering a string

livid dove
inner mulch
#

and my code is built to identify if the string is a double

inner mulch
livid dove
#

Welp

livid dove
# inner mulch i dont know what a unit test is

https://www.youtube.com/watch?v=vZm0lHciFsQ

Today is a good day to change your coding life πŸ˜‰

Full tutorial on creating Unit Tests in Java with JUnit!

Do you write Java code that you're just not confident is 100% right? You can create unit tests using the JUnit testing framework to verify your Java code, and I'll show you exactly how to do it.

Many beginners don't know there's a great way to test their code with simple, fast tests and...

β–Ά Play video
quaint mantle
inner mulch
#

even though the code seems fine

hazy parrot
#

can you show how your code doesn't work, because that code works 100%

inner mulch
#

if(isInt(String.valueOf(number)))
im using this to check if it is a double or not, before the rest of the code is executed

quaint mantle
#

Of course it will always return true

#

You are parsing a string value of a number

#

Aren't you?

inner mulch
#

maybe :(

quaint mantle
#

An integer will be always a valid double

inner mulch
#

number is args[1]

#

so player input

#

but the player input is exepected to be a double

hazy parrot
#

integer will always be double

#

as already said

quaint mantle
#

Can you show the full code?

#

You should have something like that

String input = args[1];
if (isInt(input)) {
  double db = Double.parseDouble(input);
}
inner mulch
#

wait i was changing it

#

i will try it now

#

it works now :D

#

thank you

torn shuttle
#

guys I love living in the future

quaint mantle
#

Btw, why don't you just?

String input = args[1];
try {
  double number = Double.parseDouble(input);
  //TODO: work with number
} catch (NumberFormatException ex) {
  sender.sendMessage(ChatColor.RED + "Write a valid number!");
}
#

I don't personally like the idea of making a call to a method with the same argument twice

inner mulch
#

idk, it just the only way i thought of creating it without changing to much code

quaint mantle
#

It's ok your way, it's just a personal question

inner mulch
#

everything was already done except this error check

mortal hare
#

is this the auto response

#

or some kind of karen

quaint mantle
#

if im comparing 2 invs i need to implement inventory holder?

hazy parrot
quaint mantle
#

I guess it works for player inventories, but what about custom inventories?

hazy parrot
#

and same instance will be sent in any inventory event

#

so basic == would work

quaint mantle
#

What do you check with == exactly? Should you store the created inventory somewhere to be checked for the event lately?

eternal oxide
#

yes, if you create it

quaint mantle
#

Didn't know that would just work

#

Why does InventoryHolder exist for then?

eternal oxide
#

old design. Shoudl not be used

#

unless you want to do somethign like get the block

quaint mantle
#

So like a chest block?

eternal oxide
#

yes

quaint mantle
#

I knew that the use of InventoryHolder was not "approved", but didn't know the reasons (so I still used it)

#

I guess it's time to update some code πŸ’€

mortal hare
#

InventoryHolder is used to set who holds (entity, block) the specified inventory

#

not to store metadata

#

so that's why its discouraged

#

also this method of storing metadata doesnt work with beacons and anvils afaik

#

and you need some kind of nms workarounds

torn shuttle
#

now 200% more advertiser friendly

young knoll
torn shuttle
#

you can't use that language here

#

you're going to the gulag

young knoll
#

Not the furry gulag

mortal hare
flint coyote
#

Some people believe in the a multiverse and that you exist many times with slight differences in each universe

eternal oxide
#

another world does not mean you would not be a singleton

#

even in a multiverse with exact copies you are still a singleton

flint coyote
#

Well you wouldn't be an exact copy that's what I'm saying. Sure you could still implement us in a singleton and make changes before "ticking" every universe but having multiple instances just makes it easier

young knoll
#

If I clone myself

#

Am I no longer a singleton

flint coyote
#

depends if you were one in the first place. Is there a class "Coll1234567" or are you an instance of human with a uuid?

young knoll
#

Hmm

#

Excellent question

flint coyote
#

Since humans have a lot of things in common I'd highly doubt everyone has their own class. If I had to write a simulation of planet earth I'd definitly not use a singleton for each human

young knoll
#

But would you have a single human class with all the properties

#

Or would you make some subclasses

hybrid spoke
#

for every race one

livid dove
flint coyote
#

probably dna subclasses and subclasses for diseases

#

since there is bonecancer, skincancer etc so they can all be a subclass of cancer

young knoll
#

Would each body part have a list of diseases

#

Each bone? Each cell? How specific do we go

hybrid spoke
#

each atom?

young knoll
#

Are diseases ever that specific

hybrid spoke
#

i mean, it all starts somewhere

#

what if one atom just explodes and thats the cause of the others to have a disease

#

maybe they just feel grief and thats how cancer arises

livid dove
#

Abstract Human Factory that utilises a builder. There ya go

#

done

#

Then each sub-type can implement a builder interface and boom

#

infinite posibiltiies

#

ez

#

But imo if we were to design the human race in code, its defo written in fucking VBA

flint coyote
#

I mean at some point if we have the processing power we will run simulations of the world and make slight changes to see what would have changed if x did not happen

#

It isn't unlikely we are already in one of those simulations to be fair

#

Just like people build computers on a computer in minecraft

hybrid spoke
#

wHaT wOuLdVe HaPpEnD iF hItLeR's BeEn KiLlEd

flint coyote
livid dove
#

Some stuff you simply cant predict

#

due to atoms going "lol fuck you no"

young knoll
#

Damn that would be one hell of a builder

livid dove
flint coyote
#

Well that's the most interesting part. If they really behave "randomly" you would add randomness to your simulation

hybrid spoke
#

gpt 12.5 will do that for us

livid dove
young knoll
#

Human.builder().hairColor(BROWN).eyeColor(GREEN).socialSkill(0)

#

Boy this might take a while

#

Those constants don’t really work

#

Should have done rgb

livid dove
#

lmao

#

or do a core protect and name your colors after pre existing color enums

#

;L

flint coyote
young knoll
#

Lava lamps proved to be a pretty good source of noise

#

At least for cloudflare

livid dove
#

And a similiar thing happens when we try to measure velocity / position as... yeah... the same subtle stuff that effects the electrons we are measuring, also effects the equipment we are measuring it with...

#

Does sure sound like one of those "oh how did they not realise" things that kids will say in 200 years time.

"It wasnt time slowing down the stupid shits... how can time slow down!?! It was clearly everything else that was effected and slowed"

#

Which is slightly supported by the fact all the really crazy as hell theories (dark energy and dark matter, various expansion theories, the wacky bits of relativity etc) only exist to explain discrepancies with the base theory of relativity... a theory that is built on the assumption the speed of light is constnat

#

If it wasnt constant, suddenly all those things that require really wacky cray cray bananas theories to explain away are not nessecary

sage patio
#

what is the new method?

livid dove
# sage patio

If you read the documentation it usually states the replacement my man

flint coyote
#

I once saw a video of "why no one measured the speed of light" and that theoretically we would not know whether light moves twice the speed in one direction and instantly to the other direction.
It somewhat confused me.

Sure electricity also moves with the speed of light and therefore we can't simply press a button, store when it was pressed and then check when light arrived at our outer time measuring devices. But couldn't we use something we exactly know the speed of? Like sound?

When I know that 5 seconds after the sound gets there (and I can subtract the time the sound travelled since I know and can measure the speed) the light will turn on... Can't I make an exact measurement?

hybrid spoke
#

what if there is no random

#

i believe in fate, chain reactions

livid dove
#

Entropy looks at fate and laughs

#

The universe is one giant energy chaos goblin

#

And we are just latching on for the ride

#

Plus fate is something to be fought tooth n nail.

"But suppose you throw a coin enough times... suppose one day, it lands on its edge."

Always aim for the edge lads

flint coyote
#

Honestly if we already live in a simulation it's probably government code and therefore messy as fuck

#

Probably those black holes aren't features but are instead bugs

hybrid spoke
#

black holes are just servers that crashed

young knoll
#

Idk if this is a simulation things are still holding up way too well

flint coyote
eternal oxide
#

The simulation could crash regularly, we'd never know

young knoll
#

Right but what about non crashing bugs

flint coyote
#

they could even load backups and go back to the 18th century and you would not notice

young knoll
#

Like I should have seen the windows blue screen replace the entire sky at least a few times

flint coyote
eternal oxide
#

Bugs like the duck billed platypus? πŸ™‚

sage patio
young knoll
#

Attributes are things that modify various stats about an entity

#

For example, the max health attribute modifies max health

sage patio
#

how i can use them

#

for example changing max health of an entity

young knoll
#

entity.getAttribute(Attribute.blah).setBaseValue is the easiest way

sage patio
#

thanks

#

and what are the events for health regain and hunger?

hybrid spoke
#

?bing

undone axleBOT
hybrid spoke
#

?jd-s

undone axleBOT
hybrid spoke
#

?learnjava

undone axleBOT
quaint mantle
#

Is there a way to change the title of a menu without reopening it?

river oracle
#

Hey that's my pr :F finally someone who'll use it

#

I thought maybe it was just me :P. Animated titles go brrrrr

quaint mantle
#

nah

#

for pagianted menus

#

its cleaner to not open another mneu

inner mulch
#

if(!player.getPersistentDataContainer().has(playerrand))

why is this argument causing problems, the namespacedkey is defined above?

delicate lynx
#

you have to specify data type

mortal hare
#

what kind of problems first of all

inner mulch
#

i alr did that before and datatype didnt to anything besides cause errors

delicate lynx
#

"errors"

inner mulch
#

Caused by: java.lang.NoSuchMethodError: 'boolean org.bukkit.persistence.PersistentDataContainer.has(org.bukkit.NamespacedKey)'

delicate lynx
#

correct

#

you didn't specify a datatype

#

that doesn't exist

inner mulch
#

if(!player.getPersistentDataContainer().has(playerrand, PersistentDataType.STRING))

#

is this what you mean?

delicate lynx
#

yes

inner mulch
#

but this doesnt work eiter

#

either

delicate lynx
#

"doesn't work"

#

please explain what that means

inner mulch
#

wait i will send the error

#

there is no error, but there is also no nbt data on the player

inner mulch
#

thank you for the help tho, you lead me to the right path

#

cya

delicate lynx
#

it happens to us all, take care

lavish cliff
#

how i can do if i execute a command , execute an animation from file ( .bbmodel ) and run the animation for the player?

young knoll
#

You’ll need to implement a model engine

#

Or use a public one like AquaticModelEngine

lavish cliff
#

ty

quaint mantle
#

but there isnt a way to get the title anymore

clear panther
#

my goodness i developed 27+ abilites 9 bosses but dont know how to disable tnt damaging blocks

chilly hearth
#

Lol

#

Use tntexplodeevent ig

clear panther
#

primedtnt is a entity smh

chilly hearth
#

Wait

#

Can't u

#

Vincent the blockbreak event on tntignite event ;-;

#

Cancel

clear panther
#

i tried πŸ˜„

chilly hearth
#

Then idk

wary harness
#

From which version is libraries option supported in plugin.yml?

#

And what if my premium plugin requires some libs I list them in plugin.yml

#

But as we know plugin should work without Internet acess

#

What is spigot is not able to get libs because user has no internet

#

Can I provide those libs with custom link and if yes where do user drop them in spigot folder?

rare rover
#

what's the link for mojang mappings?

#

theres a website with all the classes

#

i cant find it

rare rover
#

yep

#

thanks so much

trail coral
#

chekc if entitytype is PRIMED_TNT

#

and clear the blocklist

#

itll still trigger physical stuff like knocking off item frames, pictures etc

#

or damaging entities

clear panther
#

i want tnt damage PLAYER and not damaging BLOCKS

dull goblet
#

Is PersitentDataContainer not available in 1.8?

eternal night
#

no

dull goblet
#

What's the alternative?

vast ledge
#

saving file

#

or nms

#

then you can use nbt tags

eternal night
#

NbtAPI I guess s?

#

or, well, update to a version that is even remotely maintained

vast ledge
#

ye

dull goblet
#

Well, the plugin needs to run on viaversion server thats 1.8.8-1.20

#

So i have to develop the plugin for 1.8 right

vast ledge
#

then use nbt api

#

or via rewind

eternal night
#

Yea was about to say xD

#

via rewind would let you run 1.20.1

vast ledge
#

what I was gna say xD

eternal night
#

Might also need ViaBackwards

#

but yea

vast ledge
#

both I think, backwards goes to 1.14 and rewind to 1.8 I think

dull goblet
#

viarewind is only supported till 1.16

vast ledge
#

then backwards ih

dull goblet
#

Yeah but that one 1.10 is lowest

#

So i guess thats not an option

eternal night
#

can#t you do both

dull goblet
#

not sure

eternal night
#

Worth giving a try I guess

dull goblet
#

i think iwill start with nbtapi first

vast ledge
#

You need via version + backwards, as depicted by the graph

chilly hearth
#
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){

        Player player = e.getEntity().getPlayer();

        if(e.getEntity() instanceof Player){
            
         e.getDrops().removeIf(e.getEntity().getKiller() instanceof Player);
            player.sendMessage(ChatColor.RED + "You have been Kiled by a Player and lost all your items");


        }
``` how can i make so player items only if they are getting killed by a player
vast ledge
#

does it not work

#

if so, what the error

#

why are you checking if the entity. from the event is a player?

#

you already confirmed that when you created the player object

chilly hearth
#

nope

#

i have triedd this wait

ivory sleet
#

It doesn’t take a boolean

chilly hearth
#
 @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){

        Player player = e.getEntity().getPlayer();

        if(e.getEntity() instanceof Player){

         if(e.getEntity().getKiller() instanceof Player){
             e.getDrops().remove(player.getInventory());
            player.sendMessage(ChatColor.RED + "You have been Kiled by a Player and lost all your items");

        }else{

         }
         
        }

    }
}```
#

will that work ?

vast ledge
#

I don't got an ode or I would've checked

#

you don't need else

#

no point if it's empty

chilly hearth
#

ye

#

wil this work?

vast ledge
#

if you sent some thing, I'd be able to tell you...

ivory sleet
#

What do you mean

#

You can make player items only if they are killed by a player

Yeah that doesn’t make sense

vast ledge
#

ik

#

I read Code an decoded

#

if a play kills the player

#

he wants to remove the dropw

#

phone problems 😦

paper marlin
#

how can i cancel vehicles being pushed by explosions?

ivory sleet
#

But we don’t even know what you want to achieve

#

Including yourself

chilly hearth
#

i want players to lose items only when they die from players and no natrual death but i think ii figured it out

#
    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent e){

        Player player = e.getEntity().getPlayer();

        if(e.getEntity() instanceof Player){

         if(e.getEntity().getKiller() instanceof Player){
             e.setKeepInventory(false);
            player.sendMessage(ChatColor.RED + "You have been Kiled by a Player and lost all your items");

        }else{
             e.setKeepInventory(true);



         }

        }

    }
}```
#

nvm not working :/

#

nvm iam so dumb

#

didnt registered the event

#

let me do that real quick

#

and it works now : )

storm granite
#

does anyone know a simple way to send a string of text to a discord channel with a bot

  • in theory all you need is the string, channelID, and bot token, best way to do this without a million libraries and so on?
smoky anchor
#

Feels like you'd get a better/faster response in some discord bot dev related server.

storm granite
buoyant viper
storm granite
#

its easy?

buoyant viper
#

u would send a request to like

https://discord.com/api/v10/channels/<CHANNEL_ID>/messages

with at least the header
Authorization: <BOT_TOKEN>

the POST body would be something like

{
  "content": "<MESSAGE>"
}```
storm granite
buoyant viper
#

if ur doing it in plain old java with HttpURLConnection, .setRequestProperty("Authorization", "BOT_TOKEN"); iirc

#

it might be setRequestHeader, setRequestProperty might actually be part of JavaScripts XMLHttpRequest, i mix them up in my head a lot πŸ˜…

clear panther
#

how to check if a blaze damaged player with fireball

desert loom
#

I believe if you're on java 9+ you can also use the new http stuff

desert loom
#

I haven't looked at these but I think they might help

buoyant viper
#

i still primarily target java 8 so i never get to use it lol

storm granite
#

hmm i get some big error

#

ill

#

returned 401

buoyant viper
#

try Bearer <BOT_TOKEN> instead of just <BOT_TOKEN>

storm granite
#
URL url = new URL("https://discord.com/api/v10/channels/1126426139678744666/messages"); // Replace this with the actual API endpoint

        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("POST");
        con.setRequestProperty("Authorization", "TOKEN-HERE");
        con.setRequestProperty("Content-Type", "application/json");
        con.setDoOutput(true);

        // Construct the JSON payload
        String jsonPayload = "{\"message\":\"" + message + "\",\"recipient\":\"" + recipient + "\"}";

        // Write the JSON payload to the request body
        try (DataOutputStream out = new DataOutputStream(con.getOutputStream())) {
            out.write(jsonPayload.getBytes(StandardCharsets.UTF_8));
        }``` authorisation incorrect
grave lagoon
#

is there a way to make an item completely useless

for eg, red dye wouldnt be able to be put on a sheep or even do the animation and you cant drink or put a mundane potion in a brewing stand

or like a carrot on a stick wouldnt effect pigs

#

like just a dummy item

shadow night
#

You would probably have to listen to a lot of events to check that

grave lagoon
storm granite
#

but the good thing is, if i change the link i get the not found 404, so somethings right

smoky anchor
smoky anchor
storm granite
#

i tried the new one one its own, with Bot in front and also Bearer

icy beacon
#

how would i do an early return if i'm already returning? lol

#

return@return is not valid either

#
override fun getAction(): (Player, Player) -> Unit {
    return { killer, victim ->
      if (victim.getKitPVPLevel(plugin) < 10) return

      // other stuff
    }
  }
smoky anchor
icy beacon
#

wdym "else" statement? this is a guard clause, a singular if-statement, not an if-else

hazy parrot
#

You can just say, huh, don't return anything in this case

icy beacon
#

well, i'm returning an "action", and i want this action to not go through if the guard clause failed

#

i could theoretically extract this into
fun executeAction(player: Killer, player: Victim)

#

then it'd work yeah

hazy parrot
#

I think in that case function have to be inlined, but not sure

icy beacon
hazy parrot
#

I agree

icy beacon
#

πŸ‘Œ

grizzled oasis
#

Hi is possible to scan all the chunks and check if there are a matching block and take the coordinate?

eternal night
#

sure, finding and loading these chunks will be up to you however

#

obviously will not be cheap whatsoever

echo basalt
#

I'd suggest just doing it on chunk load

#

Otherwise disk go boom

dull goblet
#

Hello, i am trying to use NBTAPI. I initially set a value of "uses", it's just an integer. But when i try to update that integer, it doesn't override. anyone have an idea what i might be doing wrong?

    private void updateWand(Player p, ItemStack itemStack, int uses) {
        ItemMeta meta = itemStack.getItemMeta();
        meta.setDisplayName(formatUses(name, uses));
        meta.setLore(formatLore(lore, uses));
        //update the value
        NBT.modify(itemStack, nbt -> {
            nbt.setInteger(WAND_IDENTIFIER_USES, uses);
            MessageSenderUtil.sendMessage(p, "set uses to " + uses);
        });
        MessageSenderUtil.sendMessage(p, formatUses(name, uses));
        //this one says the just updated value didnt update
        MessageSenderUtil.sendMessage(p, NBT.get(itemStack, nbt -> nbt.getInteger(WAND_IDENTIFIER_USES).toString()));

        itemStack.setItemMeta(meta);
        p.getInventory().setItemInHand(itemStack);
    }
echo basalt
#

You need to set the meta before you modify the nbt

grizzled oasis
#

event.getChunk().contains() can pick only blockdata, i made it!

dull goblet
#

Yes that worked, thank you

onyx fjord
#

Y no pdc

dull goblet
#

1.8 😦

silent steeple
#

i have a spigot fork and im not sure how to build it

#

would anyone guide me in the right direction

tender shard
#

Does it have a pom.xml file?

silent steeple
#

yeah

tender shard
#

Then run β€žmvn installβ€œ

silent steeple
#

alright doing that now

#

error

#

?paste

undone axleBOT
silent steeple
chrome beacon
#

Your Java version might be too new

silent steeple
#

oh yeah

#

didn't notice

tender shard
#

Update lombok to latest in pom

#

1.18.28

silent steeple
#

the build is working rn i just changed the jdk version

#

yeah it built, thanks @chrome beacon

tender shard
#

Downgrading java is a weird fix lol

#

I would have rather updated lombok

umbral ridge
#

you would have rather jumped in your bathtub xD

silent steeple
shadow night
#

hey guys, if I have on class that uses nms and has to work in different version, how would I do that?

eternal oxide
#

depends

#

on what nms it uses

icy beacon
#

ig reflection and/or abstraction

shadow night
#

uh

eternal oxide
#

you need to tell us what nms it uses to get a proper answer

shadow night
#

I think I should rather not do that

eternal oxide
#

uh ok. odd response, then we can;t give a full answer

shadow night
#

yeah I'm just gonna leave this project

#

fuck it

icy beacon
#

???

#

ok

shadow night
#

I don't wanna do the project I was working on anymore lol

silent steeple
#

where can i find a protocolib version that supports 1.7 and 1.8

#

i had one a while ago but idh it anymore

#

and i cant find it anymore

lilac dagger
#

look on bukkit

warm mica
#

ViaRewind and ViaBackwards

dull goblet
#

I have a custom item as a stick, how do i prevent that stick from ever stacking, like an axe?

eternal oxide
#

add a pdc tag

dull goblet
#

like a UUID?

eternal oxide
#

no

#

just any tag

#

even a single byte

dull goblet
#

well the thing is the stick is a kind of wand, i now have 2 tags one for its uses and one for the wand id. But if i have 2 wands they can still stack

eternal oxide
#

add a random tag

#

you could use a UUID but thats overly complex

dull goblet
#

yeah but if i like copy the item with middle click they will still be able to stack

eternal oxide
#

don;t use creative

quaint mantle
#

can i do my objects with static ?
i don't wanna use getters

eternal oxide
#

its pretty much all client side

#

if your objects are constant yes

quaint mantle
eternal oxide
#

ie fixed, never changing

#

created once and never changes

quaint mantle
#

ah alright

#

can i do final ?

#

for this

eternal oxide
#

yes

quaint mantle
eternal oxide
#

static utility methods shoudl be stateless

dull goblet
sullen canyon
#

it's inventoryclickevent

quaint mantle
dull goblet
#

i'm talking about villager shop now, i want to fix the root of the problem.

quaint mantle
#

will be void ?

eternal oxide
dull goblet
#

like canceling middle click is treating the symptom instead of the root problem

sullen canyon
#

that's called being a spigot developer bro

dull goblet
#

well if someone were to use villager shops how would i then treat the symptom

eternal oxide
#

Does middle click have some application outside creative that I'm unaware of?

dull goblet
#

No i mean like if a villager would sell an wand, it would always sell the same wand, which causes it to stack.

vast ledge
#

will copy it

eternal oxide
#

creative is copying

#

survival has no copy

vast ledge
#

no

#

shift

#

it sprint

vast ledge
#

yes

#

why tf this autocorrect screwing me ovet

dull goblet
# eternal oxide survival has no copy

i don't think you understand, if a villager sells an item, an admin would have set that item. So if it gets sold it would always be the same item with the same tags

#

I just need to be able to set a max stack size somehow

vast ledge
#

itemstack.maxSize

#

o smth

eternal oxide
#

stack sizes can not be changed

#

only custom pdc/nbt will prevent stacking

supple compass
#

After changing version to 1.21.1, ClassNotFoundException: net.minecraft.nbt.Tag appears. How can i solve this

vast ledge
dull goblet
#

There is ItemStack#getMaxStackSize()

#

but not set

eternal oxide
#

stack sizes are based on Material and not changeable

vast ledge
smoky anchor
paper venture
#

can i use spring boot for plugin development?

smoky anchor
#

I do believe so, I have seen it once

paper venture
#

i think it can greatly ease a lot of things

silent steeple
#

?learnjava

undone axleBOT
hazy parrot
paper venture
#

im used to autowire and other things, i think without spring-web it should be fine

sturdy zealot
#

Im trying to detect if a player is in a cave, but after a lot of tries, im still not able to archieve it?, do someone know how can i do it?

vast ledge
#

You should be able to get the air type

#

check if its cave air

sturdy zealot
#

does not work

#

already tried

young knoll
#

You can easily check if they are below a block

#

Which is a start

sturdy zealot
#

already doing that , but i want to differenciate houses and caves

young knoll
#

Hmm

sturdy zealot
#

the easier way, would be that cave_air works, but for some reason is not working :(

young knoll
#

Well you could check if they are below the worldgen surface

sturdy zealot
young knoll
#

It shouldn’t

sturdy zealot
#

how do i get worldgen surface?

raven dagger
#

Good evening, I am looking for a plugin developer for Spigot, I need you to write me an addition to another plugin, if you want to discuss this, you can write me in private messages, we will discuss the price, terms, and I will explain in detail what I specifically need from you

young knoll
undone axleBOT
quaint mantle
#

does java reopen a file opened in the program?

raven dagger
young knoll
#

What

remote swallow
young knoll
#

I suppose you could combine it with the no leaves heightmap

sturdy zealot
#

2 ifs ?

grim hound
#

Why does spigot respond with an 403 error (Forbidden) when the request is sent from the server? (I'm talking about the download url, works when I type it in)

young knoll
eternal oxide
#

sent from the server?

grim hound
#

ye

#

the mc server

sturdy zealot
#

HeightMap.MOTION_BLOCKING_NO_LEAVES still detects leaves .-.

eternal oxide
#

your code sending the request must support redirects

grim hound
#

hmmm

#

what do you exactly mean by that?

#

or rather, how can I do that?

eternal oxide
#

what code are you using to perform the request?

sturdy zealot
# young knoll Yeah you can check that they are below both
    public static boolean isUnderWorldGenBlockPlayer(Player player){
            if(player.getLocation().getWorld().getHighestBlockYAt(player.getLocation(), HeightMap.WORLD_SURFACE_WG) <= player.getLocation().getY() ) {
                if(player.getLocation().getWorld().getHighestBlockYAt(player.getLocation(), HeightMap.MOTION_BLOCKING_NO_LEAVES) <= player.getLocation().getY() ) {
                    return false;
                }
            }
        return  true;
    }
grim hound
#

even after adding connection.setInstanceFollowRedirects(true); it does not work

eternal oxide
#
connection.setInstanceFollowRedirects(true);
connection.addRequestProperty("User-Agent", "Mozilla/4.0");
connection.setDoOutput(false);```
grim hound
#

oh

#

yeah, still

#

same error, 403

eternal oxide
#

spigot requres you are logged in to download

grim hound
#

uh

#

but I think you can download without being logged in

eternal oxide
#

log out and try https://www.spigotmc.org/resources/alixsystem.109144/download?version=2.4.5

#

it sends you to a login page

quaint mantle
#

No, it directly tells you that you don't have permissions

grim hound
#

allows you to immediately download

grim hound
#

the one which is necessary for downloading

eternal oxide
#

then you must be using the wrong id when you try from code

grim hound
grim hound
#

Caused by: java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.spigotmc.org/resources/alixsystem.109144/download?version=505209

#

The id is clearly correct, but I think it might be because of the CloudFlare human check

quaint mantle
#

Try changing the user agent and configuring your HttpConnection to use a recent version of TLS

grim hound
quaint mantle
grim hound
#

but isn't the cloudflare check the problem?

quaint mantle
#

I'm not sure tho

#

But you don't lose anything (but time) by trying

#

Also set the user agent to a "more realistic" than the java one

#

By default Java User-Agent is Java/<version> or smth like that

quaint mantle
hazy parrot
quaint mantle
#

Or is there an specific HTTP error code for that?

#

Why are you delaying an scheduled task?

hazy parrot
remote swallow
quaint mantle
remote swallow
#

you arent getting how it works

#

the delay isnt adding to the period

quaint mantle
#

Oh

#

Ooooh

#

I understand now

remote swallow
#

its
15 ticks delay -> task -> 15 tick period -> task -> 15 tick period

quaint mantle
#

So it won't run as soon as the scheduler starts

remote swallow
#

cant say, thats how i would do it but others would say to store it differently

quaint mantle
#

I don't think the problem is on the scheduler, maybe you are calling the upper method (which contains the scheduler) twice at some point?

#

Is it on the plugin's onEnable?

remote swallow
#

if its a private plugin just storing b64 is fine, if i was public id say some from of relational db that stores an int id to an id in another table with all the relative stack info

quaint mantle
#

Maybe the problem is on "awardCoins" method, could we see it?

hazy parrot
#

Might be dump question, but where are you giving 10 gold, I only see 100

hazy parrot
#

Lmao

remote swallow
#

add a sysout with a system get millis and see the different

quaint mantle
#

πŸ—Ώ

hazy parrot
#

Should buy glasses

#

As its running every 15 ticks, and you are rounding playtime to int by dividing by 20,it may 2 times be same number

hazy parrot
#

πŸ‘

fast merlin
#

hi so im currently making my own fork of spigot and i wanted to add my own commands so im trying to use MinecraftServer.getServer().server.getCommandMap() but i get error when i build The import net.minecraft.server.MinecraftServer cannot be resolved [21] MinecraftServer cannot be resolved

eternal night
#

I mean, are you depending on NMS ?

#

for your fork

fast merlin
#

kind of yes

#

tooo add commands from my own package

cinder abyss
#

Hello, I get this error when I mvn package my multi-module project after adding bStats :re [INFO] --- maven-shade-plugin:3.2.4:shade (default) @ alot --- [INFO] Including fr.paulem.paperapi:paperapi:jar:1.0-SNAPSHOT in the shaded jar. [INFO] Including fr.paulem.api:api:jar:1.0-SNAPSHOT in the shaded jar. [INFO] Including org.bstats:bstats-bukkit:jar:3.0.2 in the shaded jar. [INFO] Including org.bstats:bstats-base:jar:3.0.2 in the shaded jar. Unsupported class file major version 61Build configuration :xml <build> <directory>../target</directory> <!-- Build it one level up, because it is the one we care about --> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> <configuration> <relocations> <relocation> <pattern>org.bstats</pattern> <!-- Replace this with your package! --> <shadedPattern>fr.paulem</shadedPattern> </relocation> </relocations> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> </plugin> </plugins> </build>My project is on Java 17

smoky anchor
#

It means Java 17 (major version 61) compiled the class file, and if we try to run the class file under Java 16 and below environment, and we will hit Unsupported class file major version 61.
Are you running maven with the correct java version?

quaint mantle
#

Like 3.5

outer river
#
public boolean hasLore(ItemStack itemstack) {
        
        if(itemstack.getItemMeta().getLore().size() != 0) {  //Here is my error
            return true;
        }
        else return false;
    }

Hello, i dont understand why i have a NullPointerException when the item check has no lore

cinder abyss
hazy parrot
cinder abyss
outer river
#

oh damn you right, i create this for nothing

#

sry

remote swallow
#

no clue tbh

#

yeah, all the stuff thats on most items

smoky anchor
quaint mantle
#

who will help save the class file?

cinder abyss
#

Hello, should I use Bukkit.method or Server.method ?

eternal oxide
cinder abyss
#

okay thanks

small current
#

can i save yml async?

eternal oxide
#

snakeyaml is not thread safe

small current
#

what should i do, it has extereme usage

eternal oxide
#

but yes saving shoudl be async if you can

small current
#

and the data im saving is not ok for saving on a db

eternal oxide
#

you will have to sync all your saving so you don;t read and write at teh same time

small current
#

should i save it when modified

#

?

eternal oxide
#

what data?

small current
#

actually its ok to save on db

#

but i dont have time to do it

#

its something like this
username:
challenge1: 2
challenge2: 3
....

#

when they get a kill or something

quaint mantle
#

how to save handler??

echo basalt
#

I wouldn't use yml as a database

small current
#

i know it should have been with a db, but i dont have time to fix it

eternal oxide
#

store it in PDC and let teh server handle saving

echo basalt
#

I think you might do

small current
#

the data is in the file

echo basalt
#

migration tool

small current
#

i cant move it to pdc

eternal oxide
#

data is specific to a player so use PDC

echo basalt
#

Just make a basic read here and save there

small current
#

is pdc fast enough?

eternal oxide
#

PDC is on thye Player

#

it saves/loads when the player does

small current
#

Thanks

cinder abyss
#

Hello, how can I check if the clicked inventory is a the player inventory or the opened inventory in InventoryClickEvent ?

hazy parrot
eternal oxide
#

event.getClickedInventory()

#

compare to your inventory rather than the players

cinder abyss
#

okay thanks

eternal oxide
#

reverse the check though

#

as getClickedInventory can be null

cinder abyss
eternal oxide
#

no need to null check then

#

if (yourInventory == event.getClickedInventory())

quaint mantle
#

hello, I'm coding a plugin and I need every player inside a world to hear a sound
I don't want to use a for loop iterating through the players, because if they move, the sound stays behind them, I want them to hear the sound like if it was a vanilla thunder sound

eternal oxide
#

is the sound in a resource pack?

quaint mantle
#

no, it's a vanilla minecraft sound

eternal oxide
#

using playSound on the Player should make it follow the player

#

only mono sounds will follow

#

if it's stereo it will play in place

quaint mantle
#

with this code, I can't hear the sound that is played when my friend dies

#

I only hear it if I get close to him

eternal oxide
#

you are playing it on a location not teh player

quaint mantle
#

oh, that's right, I didn't know I could change the location argument for a player argument

steady rivet
#

is there a way to disable specific command aliases if another plugin is loaded?

#

I am making an econ plugin (woah totally original right?! πŸ’€) and I have under my balance commands alias /wallet & /balance but I want to make those alias usages disappear if essentials is loaded so that my plugin doesn't override it

remote swallow
#

Iirc load before the other plugin, might be the other way round and delay ur cmd registration a tick

steady rivet
#

well the command's main usage is /abalance but I have /balance as an alias. I want to disable that alias if essentials is loaded

#

in my plugin.yml file my command is ordered set like this.

commands:
  abalance:
    description: view the balance of yourself or others
    usage: /abalance [player]
    permission: argyle_econ.balance
    aliases:
      - balance
      - abal
      - bal
      - wallet
#

I am wanting to remove balance, bal, and wallet if essentials is loaded

eternal oxide
#

in onEnable check if Essentials is there, use getCommand("abalance"), then setAliases as you need before setExecutor

steady rivet
#

oh I didn't realize there was a method for setting aliases at runtime. That is exactly what I needed then. Thank you

icy beacon
#

can somebody help me come up with a formula that would graph roughly like this?
i'm trying to make it so that levelling up would increase your bonus more and more, but at a certain point the bonus increase would become lower and lower
e.g.
xp 30 -> 40 would add a bonus of 5
xp 40 -> 50 would add a bonus of 7
(peaks at 50)
xp 50 -> 60 would add a bonus of 6
xp 60 -> 70 would add a bonus of 5
etc

quaint mantle
#

I'm making a UHC plugin and there are 2 worlds in my server, "world" and "uhc"
after entering the nether from the uhc world and then leaving it, a portal is generated in "world"
what can I do so nether portals spawn inside my uhc world only?

eternal oxide
#

there is a portal spawn event you can cancel

#

portal create event

sullen canyon
tender shard
icy beacon
#

hm

warm mica
icy beacon
#

oh btw i think i sketched incorrectly

#

one sec

#

i think this is more like it

#

because before gradually decreasing it gradually increases

icy beacon
#

though i think i need a slightly different one to approach this

icy beacon
#

i'll probably do that, but now i'm curious whether it's possible with one equation

icy beacon
warm mica
icy beacon
sullen canyon
#

you need more xp to obtain a new level

#

you can somehow reverse it ig

icy beacon
#

perhaps yeah

#

but i think i'll stick to the approach of 2 equations

#

that'll be much easier to figure out

#

thx everyone πŸ™‚

carmine mica
#

smh, running build tools with --compile NONE doesn't apply the spigot patches. Why is that behind the "compile" flag?

quaint mantle
eternal oxide
#

you'd have to cancel the portal in world and create your own in uhc

tender shard
icy beacon
#

oh it's a cubic equation, that's true

#

i didn't think of that haha

quaint mantle
tender shard
#

i remember doing this manually in school but I dont remember how it works anymore lol

icy beacon
#

alright, i'll try to think of my thresholds

icy beacon
tender shard
#

been like 12 years since I had to do it by hand lol

quaint mantle
eternal oxide
#

when it attempts to create it in the main world you can get teh location

quaint mantle
icy beacon
#

there's a method in World i believe

tender shard
#

World#getHighestBlockAt(int x, int z)

quaint mantle
#

thanks, I'll try to do that and see if it works

quaint mantle
wide coyote
#

your ide literally yelling at you

#

listen to your IDE

#

you can not compare strings with != or ==

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.

wide coyote
#

use equals or equalsIgnoreCase

quaint mantle
tender shard
#

that you're not supposed to compare string using == is one of the first things your learn in every java tutorial

#

it might randomly work sometimes if the strings are cached by the JVM

#

always use equals to compare objects unless you want to check for their identity

chilly hearth
#

e

#

btw

#

just wana confirm

quaint mantle
#

I think it was that, now it seems to work, thanks :)

chilly hearth
#

ent.setMaxHealth(); we can set the max health to anything we want right like there no limit right

tender shard
#

assuming that "ent" is a living entity, it can be any positive double

remote swallow
#

the limit is defined in spigot.yml iirc

#

default is 2048

chilly hearth
grim hound
#

I'm using a custom class loader, and for some reason a clearly existing class (shows up in the loaded classes list and visible when using zip explorer) throws ClassNotFoundException. Does anyone know maybe know why?

remote swallow
#

you can, after raising the cap in spigot.yml

grim hound
quaint mantle
grim hound
#

with default config*

quaint mantle
#

Minecraft limits the max health an entity can have

remote swallow
#

spigot overwrites it

quaint mantle
#

You sure?

remote swallow
#

hold on

quaint mantle
#

Because in vanilla minecraft, it's not even possible without a mod

#

And we all know mod modifies client-side, and spigot is server-side

remote swallow
chilly hearth
#

where i can find that file πŸ™‚

remote swallow
#

same place the server jar is

#

spigot.yml

chilly hearth
#

oh so it depends on the server

#

not the plugin

icy beacon
#

what is bro cooking πŸ”₯

quaint mantle
#

help to convert the java file "handler" to a class file

chilly hearth
#
    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {

        Player player =(Player) commandSender;
        if(args.length == 0){
        player.sendMessage(ChatColor.RED + "You didnt Specify the boss!");
        
        } else if (args = ) {
            
        }

        return true;
    }``` how can i set args to a STring that a player will type
#

like /boss (Boss_Name)

remote swallow
#

args[0]

icy beacon
#

merge the array into a string and check

#

or if you need the first arg do args[0] yeah

remote swallow
#

String boss = args[0]
switch (boss) {
...

icy beacon
#

it does not see the problem

#

it just does not

chilly hearth
#

a

icy beacon
#

i'm fucking tired of trying to feed this ai

remote swallow
#

feed it chat gpt

icy beacon
#

i cannot, it's unavailable in russia

remote swallow
#

vpn

icy beacon
#

requires a registration with a phone number

#

i already constantly use a vpn because copilot left russia

chilly hearth
icy beacon
#

anyway, maybe you know a way to find a function when f(x) is known for multiple x?

#

i can just calculate it myself if i know the way

chilly hearth
#

like case: (boss_name) ??

icy beacon
#

this is not the syntax for switch-case

#

?learnjava

undone axleBOT
remote swallow
#

its either a string and switch it or you have a way to convert the string to a boss object

chilly hearth
#

ig i will go with string

#
   if(args.length == 0){
        player.sendMessage(ChatColor.RED + "You didnt Specify the boss!");
        
        }else{
          switch (boss){
              case : "Ancient"


            
        }``` ?
remote swallow
#

you need a string variable or pass in args[0]

icy beacon
remote swallow
#

also

#

?learnjava!

undone axleBOT
chilly hearth
#

ik i have to break it

icy beacon
chilly hearth
#

and stuff

remote swallow
icy beacon
#

unfortunate πŸ˜›

remote swallow
hazy parrot
icy beacon
#

well, suppose I know f(1), f(2) and f(5). I want to find f(x) that would conform to all of them

chilly hearth
#
  switch (boss){
              case Ancient: 
                  
icy beacon
#

"ancient"

chilly hearth
#

;-;

#

bro help me out here

icy beacon
#

it's a string

#

it's in quotes

#

i helped you out

chilly hearth
#

oh

icy beacon
#

?learnjava!

undone axleBOT
icy beacon
#

for the third time

chilly hearth
#

so it will be equals to args right

#

like /boss Ancient

#

and it will run the case right ?

icy beacon
#

a string cannot be equal to an array

#

are you gonna keep ignoring the learn java messages?

chilly hearth
#

bruh

icy beacon
chilly hearth
#

but the boss is equals to args

strange rain
icy beacon
#

i mean no it cannot

#

they are two different types of objects

strange rain
#

It kinda can

icy beacon
#

how lol

chilly hearth
#

;-;

#

ima test it

icy beacon
#

ffs

strange rain
#

Char array 😎 plus a custom equal method

icy beacon
#

custom equal method

strange rain
#

That’s why I said kinda

icy beacon
#

yeah an int can kinda be equal to a player

#

if you use a custom equals method

strange rain
#

Binary representation

icy beacon
#

which uses the hashcode

#

but in actual proper reality it can't

strange rain
#

Ik I am just messing around

#

I feel like there would somehow be a niche way to make an array equal a string tho

#

Idk how

#

Reflection with internal Java classes

remote swallow
chilly hearth
#

yes

icy beacon
#

it's kinda stupid lol

zealous osprey
#

wtf XD

icy beacon
#

yeah..

plush sluice
#

how can i teleport player to middle of the chunk that he is standing on?

hazy parrot
eternal oxide
#

(getChunk().getX() * 16) + 8

#

etc

rare rover
#

okay im having an issue with #isAnnotationPresent(annotation); which it present but returns false?:

private static @NotNull Field[] getAnnotatedFields(Class<?> clazz) {
        List<Field> fields = new ArrayList<>();
        for (Field field : clazz.getDeclaredFields()) {
            if (field.isAnnotationPresent(ConfigValue.class)) {
                Bukkit.getLogger().info("Inspecting field: " + field.getName() + " in class: " + clazz.getName() + " in package: " + clazz.getPackage().getName());
                fields.add(field);
                Bukkit.getLogger().info("Found field: " + field.getName());
            }
        }
        return fields.toArray(new Field[0]);
    }```
#

then the class:

@Config
public class Testing implements ConfigClass {

    @ConfigValue("test-testing")
    @Comments({"line 1 of comment", "line 2 of comment"})
    private final String test = "test";

    @ConfigValue("testing-value")
    private final String testing = "ew";
}```
remote swallow
#

have you looked at jishlib

rare rover
#

uh

#

i have not

remote swallow
#

ask @young knoll if you have any questions

rare rover
#

well shouldnt the annotation be present?

remote swallow
#

no clue

rare rover
#

that's the only thing that doesn't work

#

hmm

#

alr

remote swallow
#

never touched annotations

rare rover
#

alr, thanks

icy beacon
#

i didn't read anything except for the eq system haha

#

now i have a comical function

/**
 * Calculates the bonus for this level.
 */
fun Int.calculateBonusFromLevel(): Double {
  return (
    if (this <= 200) {
    (- 0.000000324442853307079 * this.toDouble().pow(3)
      + 2.4688812025495444E-4 * this.toDouble().pow(2)
      + 0.008644521307837891 * this
      + 0.9911089150141555)
  } else (
    - 0.0000125 * this.toDouble().pow(2)
    + 0.01125 * this
    + 8.25)
    ).roundTo(3)
}
river oracle
#

when doing paginated Inventories do you guys open a new inventory? Or just replace the contents of the one displayed

remote swallow
#

replace content

echo basalt
#

otherwise your cursor tps to the middle and its annoying

river oracle
#

O(n) be like smh smh smh

#

muh cpu cycles

#

guess I'll use Unsafe

remote swallow
#

what are you doing eyes_sus

river oracle
#

writing a library

remote swallow
#

why do you need unsafe then

river oracle
#

because a safe library is no fun

remote swallow
#

true

#

add nms

river oracle
remote swallow
#

add more

river oracle
#

I havfe more

#

I added components to ItemStacks

remote swallow
#

sukketto deez nutz

river oracle
#

dw I will have no shortage of NMS

river oracle
#

you know I go both ways right 😈

remote swallow
#

does preconditions not have a nonull

river oracle
#

it does though

#

didn't know when I wrote it though

remote swallow
#

ah

#

im wanting to write an updated inv handler

#

that adds some paginated inv pre sets

quaint mantle
#

how do i generate a java doc

#

in intellij

remote swallow
#

as in

#

like make the index.html?

quaint mantle
#

yeah

remote swallow
#

hi optic

quaint mantle
#

thx

vagrant stratus
#

How hard would it be to make a "proper" physics / destruction engine via spigot?
e.g something like: https://www.youtube.com/watch?v=GJU_P3tnf3A

Looping through every block would work, but the issue there is correct timing for every block as well as poor performance.

Creating chunks of blocks would also work, but the issue there is creating them properly and correctly timing them

vagrant stratus
icy beacon
#

just like any physics/destr engine tbf

rare rover
#

yo Optic you know anything about annotations?

vagrant stratus
#

Yea, but minecraft (and therefore spigot) has things like falling blocks.
The issue is uh... making a purely server-side not shit one

rare rover
#

im asking because some people dont

#

i've already sent my thing here

#

but no one knew

icy beacon
#

it's still physics

#

falling blocks just removes one of the middlemen

remote swallow
vagrant stratus
#

Yea, true. Given how MC is performance is the main issue. It's not really meant to contain an entire physics engine kek

rare rover
#

alr

icy beacon
plush sluice
# plush sluice how can i teleport player to middle of the chunk that he is standing on?

GOT IT!

if (sender instanceof Player player) {
                double x = player.getLocation().getChunk().getX() * 16;
                double z = player.getLocation().getChunk().getZ() * 16;
                if (player.getLocation().getX() < 0) {
                    x = x + 8.5;
                } else {
                    x = x - 8.5;
                }
                if (player.getLocation().getZ() < 0) {

                    z = z - 8.5;
                } else {
                    z = z + 8.5;
                }
                player.teleport(new Location(player.getLocation().getWorld(), x, 100, z, 180, 0));
            }
vagrant stratus
icy beacon
#

but then well probably the only plugin available for that core would be your engine lol

vagrant stratus
icy beacon
#

in that case you can just start and see whether the performance gets too bad for it to be reasonable to continue

eternal oxide
#

as the chunk x/z will always be bottom left

vagrant stratus
#

Hardcoded animations would be much more performant, but I'd want dynamic

icy beacon
#

dynamic as in?

vagrant stratus
icy beacon
#

i just don't exactly understand what you mean by dynamic. the animation, velocities, etc. will be calculated depending on the context, no?

plush sluice
vagrant stratus
#

Correct, instead of the animation, velocities, etc being a single hardcoded animation i.e. the same no matter what, it would instead be dynamic e.g. breaking blocks manually give different values therefore different physics (and therefore destruction) compared to say TNT

icy beacon
#

ah, well that doesn't seem harder to implement than the physics engine itself haha

vagrant stratus
#

The hardpart is not making the server & client commit die

icy beacon
#

allocate a shit ton of ram haha

#

but in reality i guess just try and that's it

#

if the performance is completely atrocious you'll know to stop

vagrant stratus
#

@rough drift you like physics, how possible is such an idea w/o ya know, killing everything

young knoll
#

Oh god did someone say animations

icy beacon
#

:p

vagrant stratus