#help-development

1 messages ยท Page 2229 of 1

lethal roost
#

uh anyone know what this means and how i can fix it?

summer scroll
#

If I want to update to 3, then I need to shade it right?

eternal oxide
eternal oxide
#

if you want it to work on older versions

summer scroll
#

alright, thanks

formal bear
#

I want something like command whitelist

lethal roost
eternal oxide
#

You can;t disable, but you can remove it from teh command map

limber owl
#

okay, so I have custom gui inventory and I need to add items from yml file with custom commands (not calling the commands, but the code inside)

desert tinsel
eternal oxide
#

there is no bstats in your pom

#

its probably coming from worldguard

limber owl
desert tinsel
#

where exactly?

#

it do not work anywhere

limber owl
#

worldguard

#
        <dependency>
            <groupId>com.sk89q.worldguard</groupId>
            <artifactId>worldguard-bukkit</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.bstats</groupId>
                    <artifactId>bstats-bukkit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
#

do this

desert tinsel
#

it works

#

thx

eternal oxide
quaint mantle
#

that seemd to work, thx!

limber owl
#

...how would I go about doing it?

river oracle
eternal oxide
river oracle
#

Use your brain and solve a problem

#

I'm not spoon feeding

quaint mantle
#

nothing is hard for java coding

limber owl
#

bruh

eternal oxide
#

bruh

#

do we chest bump now?

quaint mantle
#

e

limber owl
#

you doesn't seem to understand, I need to assign custom functions to event for each item, without knowing it's position, or what will it be without doing a s***ton of if statements or switches

eternal oxide
#

If you ask specific question we can answer. A general how to code reading from yaml to make items in an inventory is rather broad

limber owl
#

yes, I see how you couldn't understand, my bad

tardy delta
limber owl
#

i have loading items from custom yml config, I have a gui inventory but i want to have custom function for each item without knowing what item it is, what position it has or how many of them there would be

eternal oxide
#

do you mean you already load them from yaml. You create them and put them in the Inventory. You want to know how to detect when one of them is clicked inside the inventory?

grand iron
#
package testgroup.testartifact;

import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public final class TestArtifact extends JavaPlugin implements Listener {
    @Override
    public void onEnable() {
        getLogger().info("Test");
    }
    @EventHandler
    public void wardenDrops(EntityDeathEvent e) {
        getLogger().info("Test");
        if (e.getEntityType() == EntityType.WARDEN) {
            e.getDrops().clear();
            e.getDrops().add(new ItemStack(Material.NETHERITE_SCRAP));

        }
    }
}

Anyone know why this doesn't trigger on entity death?

limber owl
#

no, I have event for that and everything, but I need custom things like teleport player to certain position or something like that

quaint mantle
grand iron
#

how, this is my first plugin

eternal oxide
#

Bukkit.getPluginManager().registerEvents(this, this)

grand iron
#

tysm!

quaint mantle
#

nvm i have memory problems

eternal oxide
#

You were correct, just slower ๐Ÿ˜›

grand iron
#
@EventHandler
    public void wardenDrops(EntityDeathEvent e) {
        Bukkit.getPluginManager().registerEvents(this, this);
        getLogger().info("Test");
        if (e.getEntityType() == EntityType.WARDEN) {
            e.getDrops().clear();
            e.getDrops().add(new ItemStack(Material.NETHERITE_SCRAP));

        }
    }

So this correct?

eternal oxide
grand iron
#

OHHHH

#

tysm!

limber owl
eternal oxide
limber owl
#

and I need my code to know what to do after one of the items is clicked without making each item manually and without shitton of if statements

river oracle
#

Figure out a way to logically interpret the itmes

limber owl
river oracle
#

Check out my github

limber owl
#

im sorry but you're no way heling saying it's spoonfeeding to a difficult question

tardy delta
river oracle
#

I have a plug8n called Arctic inventories thags a wip

#

It has a concept that you want

#

Dig through my code and figure out how I did it

tardy delta
#

yyes cwookies

#

now say hi back to me

river oracle
tardy delta
#

lmao its for school

limber owl
river oracle
quaint mantle
round elbow
#

how can I get the localised name of an Itemstack in 1.8.8?
not the display name from meta because that returns null
im talking about the name that gets translated in game if you change the language

tardy delta
#

go to the shame corner with 1.8

river oracle
tardy delta
#

i've seen a getLocalizedName method somewhere

eternal oxide
#

shh 1,8!

limber owl
tardy delta
#

true

round elbow
river oracle
quaint mantle
#

or you just make like an assigned values for each bukkit functions and stuffs

tardy delta
river oracle
round elbow
#

the api is a bit old

quaint mantle
#

or you can do sth like reflection

river oracle
tardy delta
#

i wouldnt even work for people who use 1.8 plugins

limber owl
quaint mantle
river oracle
#

its very open sourced

#

and on my github

round elbow
#

this community is dogshit

limber owl
#

tru

river oracle
#

I'm simply infering he won't beable to read it due to the level of complexity

tardy delta
#

ah yes

eternal oxide
#

They may make a joke about it, but never a death threat

limber owl
river oracle
#

Guys how do I update from 1.8 I've been stuck on this shitty version for 6 and a half years and I can't seem to figure out how to install a plugin

limber owl
#

it was like 2-3 months ago

eternal oxide
quaint mantle
tardy delta
#

๐Ÿค”

limber owl
#

well, tell them to reply to these things when they happen

eternal oxide
#

Swearing is also permitted in moderation and in appropriate circumstances

river oracle
limber owl
river oracle
#

whenever you want really as long as its not in excess

eternal oxide
#

well, when its not you'll be banned. Its quite easy to tell when its appropriate ๐Ÿ™‚

limber owl
#

?

#

ooh, you're replying to Y2K_

#

I blocked him :kekw:

river oracle
#

guys how do I get unblocked ๐Ÿ˜ญ I'm so sorry

eternal oxide
#

I'm sure he's crying now

river oracle
#

๐Ÿ˜ญ

tardy delta
#

kiddos go watch spongebob and dont bully other kiddos

limber owl
#

okay, but we shouldn't text here, that's for #general

small current
tardy delta
#

who cares lol

river oracle
#

so true ๐Ÿ‘‘ queen

quaint mantle
small current
#

People use 1.8
Understand that

eternal oxide
#

Never!

river oracle
eternal oxide
#

1.8 is teh devil and will be purged from society!

small current
#

Too old
But the pvp is most liked

quaint mantle
# limber owl so, bump

I kind of answered your question
if you dont want to use interpreter you can use reflection through storing the string of function path
like you specfiy a function path and read it throuhg reflection and invoke it

tardy delta
eternal oxide
#

I like 1.8 combat, but I never play 1.8

small current
quaint mantle
round elbow
quaint mantle
tardy delta
#

just spam your left mouse button lmao

round elbow
tardy delta
#

i got so much kills by just using a tripleclick mouse

limber owl
small current
#

Sorry i care about performance and the pvp being real and wont use ocr

tardy delta
river oracle
small current
#

And i hate people that can help about 1.8 but they are total jerks and wont

  • how to get an itemstack material in 1.8 api ?
  • Switch to 1.19 for some reason and stop caring about the performance, also use ocm so the pvp turns into a piece of junk
quaint mantle
# limber owl how would I go about doing that, and sorry, didn't see your first answer

so you will have for example an item section that stores a string list of reflection strings right
using reflection is still building an interpreter in a way tho
so item 1:
-library.sth.ex.doStuff(arg)

you will start by getting the first three dot strings library.sth.ex as class c = Class.forname("library.sth.ex);
and then you get the method by c.getDeclaredMethod("doStuff");
and set it as accessible no matter what
and then just invoke it or sth

dire marsh
quaint mantle
#

its a quite a bit of long story so i cant say it given the length

quaint mantle
#

but you cant avoid the part where you have to build a mini interpreter

#

with your own kind of syntax

small current
#

Old combat mechanics ๐Ÿค“

quaint mantle
# limber owl thanks

note that the c.getDeclaredMethod("doStuff"); you need to pass the variable type after the doStuff
so try sticking to no arguments methods

dire marsh
#

the fuck did the r come from

quaint mantle
dire marsh
#

but yes OCM is shit

#

patch server instead

quaint mantle
#

1.9+ combat mechanics = no skills required

small current
limber owl
#

I don't know who asked the 1.8 question but I can see the war coming up again

quaint mantle
#

help

#

incoming rage in t minus 3

small current
#

Literally no skill

quaint mantle
#

yeah exactly

#

its just so stupid

#

i can pvp with one hand

#

1.8 is a much more exciting way to pvp
ya know what every time i see that cooldown bar my heart aches
its just so damn ugly for aesthetics

small current
#

And a way to ruin mouses

quaint mantle
#

indeed

dire marsh
#

is that a good thing...?

last sleet
quaint mantle
#

i also ruined my joints with jitter clicks (i bad)

last sleet
#

and I regularly butterfly 20+cps

small current
#

So people
Instead of being jerks and not helping 1.8 users
Help them if you can

dire marsh
#

minecraft 1.8: destorying your joints for nearly 7 years

last sleet
#

indeed

quaint mantle
#

yes 1.8 = the version before shitty microsoft took over

#

= og version

#

= best version

mortal hare
#

1.8 is old

limber owl
#

why do you guys hate 1.8 (serious reply only)

mortal hare
#

that's why its not supported

#

not because its pvp is superior

quaint mantle
mortal hare
#

it uses Java 8

#

when modern versions use java 16-17

quaint mantle
#

oh so they are being java racists

last sleet
small current
quaint mantle
#

java 8 is the best

last sleet
#

but tbh for any other things than competitive mc, 1.9+ is better

mortal hare
#

it doesnt support async chunk loading unless its NMS was altered heavily by some fork iirc

limber owl
quaint mantle
small current
limber owl
#

btw, there are no replies from players who hate 1.8 because they have no serious reply ๐Ÿ™‚

quaint mantle
#

oh come on

mortal hare
dire marsh
# limber owl why do you guys hate 1.8 (serious reply only)

Because I find it very plain and boring, and the amount of bugs caused by using such old server software and trying to support newer clients deters me as a person who always uses the latest version. I don't care about the PvP, I play both types, and I would rather have newer features. 1.8 also has tons more hackers and glitches. It also hurts my hand...

mortal hare
#

Minecraft is all about survival and creative game modes, minigames are second part of this game

small current
#

They are pvp with small maps mostly using swm

last sleet
quaint mantle
#

its better to open servers with 1.8
1.8 is for more plugin features

limber owl
mortal hare
#

it doesnt have proper boss bar features

#

you need to spawn wither or ender dragon

quaint mantle
#

nms makes it more cooler

mortal hare
#

via packets

#

in order to use it

#

no action bar api support iirc

#

in spigot

quaint mantle
#

its just few lines of codes lol

small current
quaint mantle
#

yessss

#

thats the pointtttt

dire marsh
#

Hypixel does a lot of magic to have version-independent features such as glowing. But overall it's so buggy it gets super annoying, and it's absolutely infested with hackers.

quaint mantle
#

doing a simple api call makes it very discouraging

mortal hare
#

If NMS is more fun, just use plain vanilla minecraft server

quaint mantle
#

oh i will consider doing that dw

#

but plugin along with nms tampering is the best kind of combination in the world

dire marsh
#

also I always use newest client, because 1.8 has different horizontal/vertical sensitivities, and I get better FPS on latest

quaint mantle
#

i get 5 fps on latest and 60 on 1.8

mortal hare
#

Also implementing boss bar in 1.8 is not a few lines of code.

#

just like you said

#

you need to move fake entity

quaint mantle
#

oh damn i have memory problems

mortal hare
#

it is few lines of code on 1.9+

dire marsh
#

I think for 1.8 you have to spawn a literal wither on the client

mortal hare
#

1.9 implements bossbar support in API

last sleet
dire marsh
mortal hare
#

also since 1.16 you can do this:

twilit roost
#

How to make gizmos?

This doesnt work for me:
TestCommand:

        if(sender.hasPermission("tomkodebug")&& sender instanceof Player p){
            Gizmo.createGizmo(p.getLocation(),p.getLocation().getDirection(), Color.BLUE,10);
            p.sendMessage(ChatColor.DARK_GRAY + "Created Gizmo");
        }

Gizmo:

    public static void createGizmo(Location at, Vector dir, Color color,float length){
        float r = color.getRed()/255;
        float g = color.getGreen()/255;
        float b = color.getBlue()/255;

        Location curLoc = at;

        for (int i = 0; i == length; i++) {
            curLoc.getWorld().spawnParticle
                    (Particle.REDSTONE, curLoc.getX(), curLoc.getY(), curLoc.getZ(), 0, 1, 0, 1, 1);
            curLoc.add(dir);
        }
    }
mortal hare
#

hello custom sky, grass, and dimensions

dire marsh
last sleet
#

I think the reason why servers keep having multiple-version support is because no one wants to keep switching versions, but a client that automatically does that would be very handy

mortal hare
#

on 1.16+

twilit roost
#

how?

dire marsh
#

I know, I never knew cauldrons changed colour though.

mortal hare
#

custom chat RGB support on 1.16

mortal hare
#

custom font support, not overriding other fonts

twilit roost
ivory sleet
dire marsh
#

There is the multiconnect mod

#

which basically does the same

ivory sleet
#

Sounds hacky

twilit roost
dire marsh
#

As of the time of writing, multiconnect is the only mod which fixes 1.12 swimming mechanics, parkour differences, and re-adds removed features such as command syntax on the client.

mortal hare
#

since 1.13+ you can add custom model data to items

#

which allows you to create custom items

#

with resource packs

#

easier than ever

#

there are plenty of reasons why 1.8 should be ditched

#

the only thing that keeps 1.8 running is pvp

twilit roost
#

fax

dire marsh
#

Well Mojang was making combat snapshots but it seems to have died.

small current
mortal hare
#

Yes

dire marsh
#

have you tried debug statements etc

twilit roost
last sleet
dire marsh
#

knockback

#

implementing blocking with shields sucks

mortal hare
small current
#

@mortal hare how is that done the color thing

dire marsh
#

i think there are a few extremely technical changes too

#

like parkour

last sleet
twilit roost
mortal hare
last sleet
dire marsh
small current
#

the trees can also be colored ? @mortal hare

mortal hare
#

yes

#

tree leaves are also coloured

small current
#

is there a guide for that

mortal hare
#

grass, vines, water, sky color

last sleet
tardy delta
mortal hare
dire marsh
mortal hare
#

BiomeSpecialEffects in Mojang's mappings

#

is the class which you would want to apply to a biome

mortal hare
#

in order to change

#

everything is in BiomeSpecialEffects class

#

including fiolage colour

#

you can even set the ambient music through there

twilit roost
#

Is there some tutorial for custom sky with NMS Remapped? @mortal hare

mortal hare
#

not sure

quaint mantle
twilit roost
#

yeye ikr

tardy delta
#

๐Ÿคฎ

quaint mantle
#

if you know then why ask

twilit roost
#

i meant ikr what the parameter works

#

idk why it didnt spawned

small current
#

@mortal hare is there any tutorial for it ?

#

water and trees

mortal hare
quaint mantle
#

you didnt pass the rgb parameters in bro i thought you didnt know what they do

quaint mantle
small current
mortal hare
twilit roost
#

It saves some lines of code

mortal hare
#

auto casting

quaint mantle
#

oh im so off the trend

twilit roost
#

its same as doing ```java
if(sender instanceof Player)
Player p = (Player) sender;

quaint mantle
#

im still stuck in 6 years ago

tardy delta
#

people giving their variables a one letter name ๐Ÿ’€

quaint mantle
#

holy shet

mortal hare
#
if (entity instanceof Player player) {
  player.sendMessage("Hello!");
}

vs

if (entity instanceof Player) {
  ((Player)entity).sendMessage("Hello!");
}
#

i bet you can send message to an entity too

#

but i dont care

#

you can also use lambda expression in switch cases

tardy delta
#

return switch owo

twilit roost
#
        at.spawnParticle(Particle.REDSTONE, curLoc.getX(), curLoc.getY(), curLoc.getZ(), 0, 0.001, 1, 0, 1);
tardy delta
#

give it data

twilit roost
#

damn bro u are as usefull as bean in middle of the ocean

tardy delta
#

ik

quaint mantle
#

LMAO

#

lmfao

mortal hare
#

lol

quaint mantle
#

why havent i thought of that yet

#

hire me google

#
loc2.getWorld().spawnParticle(Particle.REDSTONE, loc2, 1, new Particle.DustOptions(Color.fromBGR(red, green, blue), 1));
twilit roost
#

i was just looking at same post ๐Ÿ˜„
thjx

quaint mantle
#

I am as useful as water in sea

#

thank me

#

oh thx for thanking me be oxygen in air

#

dw

#

Guys call 911 i just murdered the chat

#

pls its bleeding

twilit roost
#

so I have particle spawning ( finnaly )
But can't get it to make a line

        Location curLoc = at.getLocation();
        at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
        for (int i = 0; i == length; i++) {
            at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
            curLoc.add(dir.multiply(3));
        }

It just spawns a few particles on same position

quaint mantle
#

try normalizing it before multiplying it

#

cuz it may be in decimals idk

twilit roost
#

nope

eternal oxide
#

what is dir?

quaint mantle
#

a vector

eternal oxide
#

I can see that, where is it from

quaint mantle
#

from the server

eternal oxide
#

Be obtuse. but that code will not work as you are modifying the curLoc and the dir vector every loop

#

two particles and its out of range

quaint mantle
#

im quite obtuse after some brain burning by cpp

eternal oxide
#

yep cpp will do that

twilit roost
#

that is the only meaning of it
since i want to create a line from particles

eternal oxide
#

where are you getting dir from?

twilit roost
#

player.getLocation().getDirection();

eternal oxide
#

ok

#

well first off you don;t want to modify curloc and dir every loop

twilit roost
#

so what should i do instead?

eternal oxide
#

curLoc.add(dir.multiply(3)) is adding the vector to curloc and multiplying it every loop

#

curloc.add(dir)

#

will only update curLoc

#

if dir is a Player Location#getdirection it is a unit vector so no need to normalize

#

nor multiply as its a length of 1, so one block in teh direction the player is facing

#
Location curLoc = at.getLocation();
for (int i = 0; i <= length; i++) {
    at.spawnParticle(Particle.REDSTONE, curLoc, 5, new Particle.DustOptions(Color.fromRGB(r, g, b), 1));
    curLoc.add(dir);
}```
twilit roost
#

thats what i made rn
and still doesnt make a line

quaint mantle
#

i think you need more complex stuffs than that

eternal oxide
#

do you get a single particle?

twilit roost
#

5 at one loc

eternal oxide
#

I fixed the for loop, try it again

#

what is the value of length?

twilit roost
#

length = 1000

#

rn

eternal oxide
#

ok

twilit roost
#

to test it if its in pixels

eternal oxide
#

That code should spawn you 10 particles in a row

#

pixels?

twilit roost
#

idk

#

chjanged it to 10

eternal oxide
#

a Vector of 1 in any axis is 1 block

twilit roost
#

yep works now

#

thx

formal bear
twilit roost
#

try googling
not near PC rn

twilit roost
formal bear
twilit roost
#

maybe ngrok for debugging

#

try making the connect values modify-able using config

And try setting it to ngrok?
that's my idea

formal bear
tardy delta
#

just add a permission to a command and it will show up as red when they try to type it?

desert tinsel
#

what method do I need to have for reload a file.yml?

tardy delta
#

load it back to the fileconfig?

formal bear
desert tinsel
formal bear
#

I want to disable access for minecraft: and other plugins commands

#

so no /version, /plugins etc

desert tinsel
#

do u use a custom plugin for scoreboard?

#

what plugin do you use for ranks?

tardy delta
desert tinsel
#

wdym custom

tardy delta
#

uhh

desert tinsel
#

what kind of ranks do you have

#

if you use luckperms, you need to load PlaceholderApi plugin to your server: https://www.spigotmc.org/resources/placeholderapi.6245/ and you can add a placeholder into your scoreboard plugin's configution file like: %luckperms_prefix%, also you need to download the placeholder with /papi ecloud download LuckPerms.

#

@viral hazel

quaint mantle
#
        Scanner city = new Scanner(System.in);
        String cityResult = city.next().trim();```
Is that the best/most efficient way of getting user input?
#

i hope you know that only works for console and in the worst way imaginable

#

well im only using console for now

#

i started like 3 days ago

#

whats a better way of doing it then

desert tinsel
#

if you want to use in game, you can use AsyncPlayerChatEvent listener

quaint mantle
#

im not talking about spigot

#

i mean just java

desert tinsel
#

actually it is

quaint mantle
#
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
desert tinsel
#

+mess

quaint mantle
#

whats the difference between nextLine and next

#

coz i just used next

#

pretty sure next returns a char or escape code

glossy venture
#

next just gets the next one character i believe
or it collects until a \0 aka null char is reached

quaint mantle
#

oh ye it shows only the 1st word of the string

desert tinsel
#

you use .next().trim

quaint mantle
#

i removed the trim and it still just shows the 1st word

#

i think trimming removes the space at the start if i decided to put like 10 spaces

lethal roost
#

my plugin config doesn't seem to be reloading, what's the cause of this?

        if(cmd.getName().equalsIgnoreCase("hvwreload")) {
            this.reloadConfig();
            sender.sendMessage(ChatColor.GREEN + "HeavyWeapons reloaded successfully");
            return true;
        }
        return false;
    }```
desert tinsel
#

i have the same problem

tall dragon
lethal roost
#

like this?

        if(cmd.getName().equalsIgnoreCase("hvwreload")) {
            this.reloadConfig();
            this.saveConfig();
            sender.sendMessage(ChatColor.GREEN + "HeavyWeapons reloaded successfully");
            return true;
        }
        return false;
    }```
desert tinsel
#

yep

lethal roost
#

aight lemme try

coarse shadow
#

anyone used kotlin for spigot be4?

#

i have a question

split lake
#

i got an error where i get a stackoverflow: null error but i cant seem to find the problem, i tried debugging and its somewhere in the class im gonna send, not outside of it

#

error:

ivory sleet
eternal oxide
#

?paste the full error

undone axleBOT
split lake
#

My discord is glitching

#

Wait

coarse shadow
tardy delta
#

shade it i guess

coarse shadow
#

i did

#

still

split lake
#

nms btw

coarse shadow
#

isnt java code 100 percent compatible with kotlin

#

i thought they might work

eternal oxide
#

SpawnEntity.java:63

river oracle
eternal oxide
#

You are spawning an Entity, which is triggering yoru onSpawn event, which is spawning an entity

tardy delta
#

kotlin has like toJava stuff

coarse shadow
#

lemme try to shade again

#

aight i got it

#

i had to enable java parameters in kotlin compiler

smoky oak
#

is there a list of everything that you can do outside of the main thread (ie utilizing the like 30 extra cores modern cpus have) to reduce performance impact?

ivory sleet
#

list?

smoky oak
#

like everything you can do off the main thread

ivory sleet
#

oh nope

#

I mean there are designs where methods are annotated with sth that denotes thread safety

#

but those arent perfect

smoky oak
#

i see

#

what im trying to do is to have as little load as possible on the actual server

#

but offloading stuff to other threads especially data stuff is hard

humble tulip
#

what are you making?

humble tulip
ivory sleet
#

what are you after, concurrency or parallelism?

smoky oak
#

concurrency mostly

#

if i end up at needing parallelism god help me

ivory sleet
#

okay so you want high throughput in other words?

kind hatch
humble tulip
ivory sleet
#

generally concurrency means when two tasks are done seemingly concurrent, but in reality not
parellelism denotes where two tasks are actually done at the same time

when we talk about concurrency the measurement is throughput
when we talk about parallelism latecy is the measurement

kind hatch
#

Ah. Gotcha.

smoky oak
ivory sleet
#

java kinda sucks when it comes to high throughput as we only have platform threads (since cheap virtual threads are gonna release with java 19)

smoky oak
#

wait then how do threads get distributed over cores?

ivory sleet
#

implementation detail

tardy delta
#

java threads being mapped to os threads?

smoky oak
#

ye

#

like

eternal night
#

the java channel actually had a decent video on it

#

like their youtube stuff

smoky oak
#

my crapppy computer has four cores and my server fourty, one at ninety percent and all others at zero

eternal night
#

still pretty top level but, gets you the basic mapping between carrier and virtual thread

smoky oak
#

hence the question

ivory sleet
#

anyway moterius, as of now the best "way" to handle throughput is through an executor service such as ForkJoinPool

smoky oak
#

oho

#

looks interesting

obtuse ocean
#

can you guys tell me how to add a rank to my scoreboard so they can see what rank they have

humble tulip
tardy delta
#

๐Ÿค”

humble tulip
eternal night
#

an OS/platform thread does not mean it allocates an entire core

#

o.O

tardy delta
#

imagine...

ivory sleet
#

well, when two tasks run concurrently we usually mean they run on the same core, its just that the code does not run linearly, which often means the program will execute a little bit of task A, then task B then back to task A etc, seemingly at the same time but in reality not

eternal night
#

your 16th chrome tab ?

tardy delta
#

aha cpu gone ๐Ÿ˜‚

eternal night
#

RIP

desert tinsel
quaint mantle
tardy delta
#

not you

desert tinsel
humble tulip
#

hm i didnt know that, it makes sense now thinking abt it

ivory sleet
#

yeah

smoky oak
ivory sleet
#

as opposed to when to two tasks run in parallel, it means they might actually be running at the same time

#

no

humble tulip
#

how do u tell java which to do?

ivory sleet
#

java's thread pools and threads abstract away the need to even manage the coordination of execution

obtuse ocean
ivory sleet
#

like two threads might be running on different cores, or they might not

humble tulip
river oracle
#

do you mean JavaScript

obtuse ocean
#

ye

#

i need like normal script

river oracle
#

wait what I'm confused

humble tulip
ivory sleet
#

and Moterius, runnable is just an interface for a single abstract method

#

it doesnt know about where it might run

#

that is chosen by the jvm

#

or well, to some extent yourself

eternal night
#

wouldn't it be chosen by the OS ๐Ÿค”

humble tulip
#

so do you really have a choice over parallelism or concurrency?

ivory sleet
humble tulip
tardy delta
#

i once read a book about the inner workings of an os and i got halfway ๐Ÿค” ๐Ÿฅบ ๐Ÿ™

humble tulip
#

NERDS

kind hatch
tardy delta
#

yes

eternal night
#

I mean JVM doesn't schedule anything threads rn

#

that is the point of loom

#

so I'd expect all thread scheduling to be done by the OS

ivory sleet
#

ah okay

eternal night
#

could be wrong tho

#

ยฏ_(ใƒ„)_/ยฏ

ivory sleet
kind hatch
#

Noice

smoky oak
#

so it schedules stuff as it thinks best, but I know that thread-zero and thread-one are the most heavy loads. Can i somehow guarantee that it wont be ran on the core those two run?

ivory sleet
#

altho as of now, joining tasks is the big thing right

molten hearth
#

if I wanted to 'throw' a player into a random location, I would just set his velocity right?

ivory sleet
#

and then we have stuff like semaphores and other concurrent utility classes

weak wasp
#

If it fits your needs you can always use thread safe events when needed and ensure order execution on the main thread

eternal night
#

iirc java does not allow you to define thread affinity

#

you would have to use JNI

ivory sleet
#

yup sadly

eternal night
ivory sleet
#

@smoky oak might wanna look at that ^^

smoky oak
#

yea

#

what i need to do as well is run some tests if using extra threads costs more time on initialization than it saves in performance

ivory sleet
#

performance as in speed, or just being able to handle high throughput?

molten hearth
smoky oak
#

first one. I'd like to have as fast performance as possible. In my experience most software always goes up against the clock speed, not the core number. Like, my server has fourty cores, only one being used

undone axleBOT
humble tulip
#

yes setting velocity can throw a player

ivory sleet
smoky oak
#

luckily the stuff i work on really doesnt comes much into contact with that

tardy delta
#

think about rust which doesnt allow passing non thread safe stuff to another thread ๐Ÿ™

ivory sleet
#

well thread un-safety becomes apparent when applications use multiple cores

molten hearth
#

well im not exactly using spigot im using an api thats based off bukkit but my code is more or less java Player player = ... Vector vec = new Vector(player.getLocation().getBlockX() + 0.1, player.getLocation().getBlockY()+0.1, player.getLocation().getBlockZ()+0.1); player.setVelocity(vec);

weak wasp
#

its more so the memory that gets compromised with threads

humble tulip
#

cuz ur using their location

molten hearth
#

๐Ÿค” so just 0.1?

humble tulip
#

yes

weak wasp
#

simultanous read / write operations are the main issue

humble tulip
#

if they're at 1000, 100, 1000

molten hearth
#

oh shit lol that probably explains it ty

#

pfff 1000.1 velocity i see the mistake now ๐Ÿ˜‚

humble tulip
#

yeah

molten hearth
#

I assumed if I set it to anything lower than their location it would shoot them down but I guess thats just negative velocity

ivory sleet
smoky oak
humble tulip
#

direction they're looking?

molten hearth
#

tbh

#

im trying to re-make tnt knockback

humble tulip
weak wasp
#

you know straight down is (0, -1, 0)

#

not -1-1-1

humble tulip
smoky oak
#

got a blog or example?

humble tulip
#

well not exactly other cores

#

but other threads

tardy delta
#

what ๐Ÿ‘€

molten hearth
#

damn this is a lot of maths

smoky oak
#

urgh generics

humble tulip
molten hearth
#

here I was gonna just pick any random 3 numbers lol

ivory sleet
#

well completable futures are at most an abstraction Id say

#

like it depends on the executor you supply given instance with

smoky oak
#

hm

#

how would you pass data between helper threads and the main thread?

quaint mantle
#

synchronized blocks

#

and queues

ivory sleet
#
  • callbacks
tardy delta
#

and the locks?

ivory sleet
#

synchronized technically

tardy delta
#

hmy yea

humble tulip
#
public class TwoSums {
    
    private int sum1 = 0;
    private int sum2 = 0;

    private Integer sum1Lock = new Integer(1);
    private Integer sum2Lock = new Integer(2);

    public void add(int val1, int val2){
        synchronized(this.sum1Lock){
            this.sum1 += val1;   
        }
        synchronized(this.sum2Lock){
            this.sum2 += val2;
        }
    }
}
quaint mantle
#

Incredible

tardy delta
#

i should learn that stuff

humble tulip
#

since 2 diff locks are being used, does that mean that if add is called, and sum1 is locked, can sum2 be executed?

ivory sleet
#

AtomicInteger

humble tulip
#

i'm reading up on concurrency

ivory sleet
#

oh

humble tulip
#

and this was an example

#

they did say to use atomic integer but to explain the concept

ivory sleet
#

well

#

they use two different locks

humble tulip
ivory sleet
#

yes that makes more sense

#

altho thats also to some extent an anti pattern

#

usually wanna do


Object lock = this;

//then
synchronized (lock)
#

(since it becomes more apparent what the intent is)

humble tulip
ivory sleet
#

yep

#

minion let me draw some for ya

humble tulip
#

my question is if add is called, and the first sum is locked, does it do sum2 and then wait for sum1?

#

or is the order of the method preserved?

ivory sleet
#

well the first sum nor the second sum are locked

#

the instance itself is being locked

ashen quest
#

kotlin

ivory sleet
#

oh

#

no it doesnt

#

sum1 doesnt wait for sum2 nor the converse

humble tulip
#

what if i had code inbetween the 2 synchronised blocks

#

when does it execute sum1

#

and the code between blocks

ivory sleet
#

the question is very vague

#

like are we talking about when you invoke this method concurrently on 2 different threads?

humble tulip
#

yes u invoke add() with 2 synchronised blocks on 2 diff threads

ivory sleet
#

okay, so only one thread can run

            this.sum1 += val1;   

at the time

same goes for

            this.sum2 += val2;
#

but code in between might run concurrently

humble tulip
#

ahh ok i understand

weak wasp
#

I'm still not sure why you would synchronize those. The memory is private so each instance of your function makes its own memory space then tosses it to the garbage collector. That function will never be unsafe. It would if the memory was public and another thread tried to fiddle with one of the variables

ivory sleet
#

wat

weak wasp
#

like I get that you made it thread safe, but it probably already was

ivory sleet
#

the sum2 and sum1 variable can be manipulated concurrently

humble tulip
ivory sleet
#

no it wasnt

#

because

var+=val is more than a single instruction

humble tulip
#

its a get add update

weak wasp
#

+= is literally one instruction

ivory sleet
#

literally not

humble tulip
#

no

weak wasp
#

i always thought it was

ivory sleet
#

it has to get the value from var has to add val to it again, and store the sum back to var

#

more than one instruction

humble tulip
weak wasp
#

thought all operators got condensed to one instruction...

quaint mantle
#

doesnt work like that

smoky oak
#

thats just for faster typing

quaint mantle
#
a += 5;
//a = a + 5;
loadconst 5
load a
add
storevar a
ivory sleet
#

^

#

+= is just syntax suger

glossy venture
quaint mantle
glossy venture
#

so it wouldnt matter

smoky oak
#

what assembler language is that

glossy venture
#

bytecode but readable

quaint mantle
glossy venture
#

yooooo

quaint mantle
#

well basically

#

here

glossy venture
#

it on github

smoky oak
#

huh

glossy venture
#

i want to make vm too but makefiles are a pain

smoky oak
#

i dont know rust

quaint mantle
#

i havent even added an add instruction

quaint mantle
glossy venture
#

nah

#

i like c++

quaint mantle
#

K

glossy venture
#

but rust is good

tender shard
#
    /**
     * Combines the given arrays into a new array
     */
    public static <T> T[] combine(final T[]... array) {
        int totalSize = 0;
        for(T[] part : array) {
            totalSize += part.length;
        }
        T[] combined = (T[]) Array.newInstance(array.getClass().getComponentType(), totalSize);
        int index = 0;
        for(T[] part : array) {
            for(T element : part) {
                combined[index++] = element;
            }
        }
        return combined;
    }

can anyone think of an easier way to do this?

quaint mantle
#

what does it do

tender shard
#

combines different arrays

glossy venture
#

you could use System.arraycopy(...)for speed

quaint mantle
#

^

tender shard
#

e.g. [1,2] and [2,3] will become [1,2,2,3]

tender shard
#

but yeah

quaint mantle
tender shard
#

nah then I'd rather do it like this

smoky oak
#

lol

tender shard
#

hm not sure whether this would work

    public static <T> T[] combine(final T[]... array) {
        int totalSize = 0;
        for(T[] part : array) {
            totalSize += part.length;
        }
        T[] combined = (T[]) Array.newInstance(array.getClass().getComponentType(), totalSize);
        int index = 0;
        for(T[] part : array) {
            System.arraycopy(part,0,combined,index,part.length);
            index += part.length;
        }
        return combined;
    }

let's see

glossy venture
quaint mantle
#

also

#

that is pretty damn slow

tender shard
#

System.arraycopy is way faster than streams

glossy venture
#

yeah

quaint mantle
#

ik but time complexity

tardy delta
#

native stuff kek

quaint mantle
#

thats like O(nk) worst cast scenario

#

arraycopy is O(n)

tender shard
#

i dont think you can get it any faster than looping for the arrays and then doing arraycopy

glossy venture
#

yeah

quaint mantle
#

kk

tender shard
glossy venture
#

yeah

#

exactly

tender shard
#

ok then I'll try it out

glossy venture
#

i think

humble tulip
#

it;s the same

tender shard
#

works perfectly lmao

smoky oak
#

?

tender shard
#

idk

glossy venture
#

it looks like youre trying to combine a String[] with a String[][]

#

im pretty sure [L; means array of objs

tender shard
#

this is my test

#

the last one

humble tulip
#

Canu pastethose arrays

quaint mantle
#

ArrayUtils.addAll()

tender shard
#

I guess the problem is T[] should be T

#

I don't wanna depend on apache commons

glossy venture
#

@tender shard your reflected array instance is usign the type of the input array of arrays to create a new one

quaint mantle
#

its included in the spigot jar..

glossy venture
#

Array.newInstance(array.getClass().getComponentType(), size);

tender shard
quaint mantle
#

Why the fuck

glossy venture
#

you need to get the component type of the component type

tender shard
glossy venture
#

yeah

tender shard
#

so getComponentType().getComponentType()

#

lets see

glossy venture
#

lmao

twilit roost
#

Does anyone know how to create custom Biomes in NMS Remapped?

My Current Code:

        Server server = Bukkit.getServer();
        CraftServer craftserver = (CraftServer)server;
        DedicatedServer dedicatedserver = craftserver.getServer();
        ResourceKey<Biome> newKey = ResourceKey.create(Registry.BIOME, new ResourceLocation("pirates", "darkwaters"));

Error:

tender shard
#

yep that works

#

replacing getComponentType() with getCOmponentType().getComponentType() fixes it

glossy venture
#

aight

tender shard
#

thx everyone

glossy venture
#

idk why

#

but thats the error

mortal hare
#

man i hate myself

#

I spent 8 hours trying to find a bug

#

why my itemstacks are gone

#

after closing down inventory

#

to find out the problem wasnt in NMS but in my Inventory debug code

#

i created new Inventory everytime

#

i opened

twilit roost
#

Maybe fixed it
I was using bukkit Registry instead of Mojang Registry

mortal hare
#

this was related

#

to my search of the problem

undone axleBOT
mortal hare
left swift
#

Is there any event that is called when effect is applied to the player?

twilit roost
#

How to get WritableRegistry from dedicated server?

#

@mortal hare you mentioned before custom biomes
Have you tried making one yourself?
If so, could I ask some questions?

mortal hare
#

but as I already told you there is a class BiomeSpecialEffects

#

are you using mojang's mappings?

twilit roost
#

yep

mortal hare
#

BiomeSpecialEffects class represents all the colors for your biome

#

BiomeSpecialEffects.Builder class allows you to easily build your own BiomeSpecialEffects class

twilit roost
#

so I can change colors of everything using that

mortal hare
#

yes

#

but you need to apply to the biome

#

you can build your own biome using Biome.builder class too

#

in which you can specify your built BiomeSpecialEffects class

twilit roost
#

BiomeSpecialEffect.Builder#fogColor requires int
should it be hex?

mortal hare
#

yes

#

its optional

#

you can use hex by using 0x prefix

#

to your hexidecimal number

twilit roost
#

oh right

mortal hare
#

for example 0xFFFFFF

twilit roost
#

btw how did you did that black overlay over that?
ik about 3x` but that puts it into seperate line

#

I mean this

hushed spindle
#

i have a question about nms, i want to start working with it but obviously it's normally obfuscated and harder to work with. i now have the mojang mappings, but they don't seem to match what is commonly used online. like where someone is saying to use CraftPlayer#getHandle().playerConnection.networkManager.channel.pipeline() i instead have to use CraftPlayer#getHandle().connection.connection.channel.pipeline() which is the only thing it recognizes

#

how can i get it to use the more common mappings

#

and instead of PacketPlayIn.. and PacketPlayOut.. i get Clientbound.. and Serverbound..

twilit roost
ornate patio
#

how do you check if a block if waterlogged in NMS

mortal hare
#

``text``

#

2 backticks instead of three

twilit roost
#

oooh
imma tryy

#

wow nice ๐Ÿ˜„

humble tulip
quaint mantle
humble tulip
#

check if it's instanceof waterlogged

#

then cast and call isWaterLogged

ornate patio
humble tulip
ornate patio
#

do you mean blockstate?

humble tulip
#

Block.getBlockData

hushed spindle
#

he's asking in nms

humble tulip
#

no blockdata

#

oh in nms?

hushed spindle
#

why do you want to use nms for this anyway

humble tulip
#

why are u using nms for waterlogged?

twilit roost
ornate patio
#

it's in my horse's custom pathfinding goal

humble tulip
#

get the bukkit block

ornate patio
#

i dont want to convert every nms blockpos to a spigot block though

#

it isn't resource efficient

humble tulip
#

one sec

#

i'll look at how it's done internally and tell u

ornate patio
#

thx ๐Ÿ™

mortal hare
#

Biome bukkit class and NMS classes are two distinct things

twilit roost
#

oh there is also NMS Biome ๐Ÿ˜„
Nah I wasn't

formal bear
#

where to set permissions for event not command? ik about plugin.yml but i dont know where to put it

ivory sleet
#

nope

#

there isnt

#

most events are not command sender driven

formal bear
#

i made it working, when i set the permission but for example luckperms doesnt show it

humble tulip
ornate patio
#

oh wait I'm using mojang mapped

#

lemme search up what those method names are

humble tulip
#

ye

#

or u can see what returns IBlockData and takes BlockPosition as an arg

ornate patio
# humble tulip

wait is this how to convert an nms block to a spigot block

ornate patio
#

this is detecting waterlogged in NMS?

humble tulip
#

it how spigot gets blockdata internally

twilit roost
ornate patio
#

thanks

humble tulip
#

it's best to use spigot tbh

#

nms is messy

hushed spindle
#

i want to start working with nms but obviously it's normally obfuscated and harder to work with. i now have the mojang mappings, but they don't seem to match what is commonly used online. like where someone is saying to use CraftPlayer#getHandle().playerConnection.networkManager.channel.pipeline() i instead have to use CraftPlayer#getHandle().connection.connection.channel.pipeline() which is the only thing it recognizes, and instead of PacketPlayOut and PacketPlayIn i got Clientbound and Serverbound packet class names

twilit roost
harsh totem
#

how do I add a custom item ingredient to a ShapedRecipe?

humble tulip
#

do u use maven?

mortal hare
#

new BiomeSpecialEffects.Builder()

tardy delta
humble tulip
#

u should

#
<dependency>
    <groupId>com.zaxxer</groupId>
    <artifactId>HikariCP</artifactId>
    <version>5.0.1</version>
</dependency>
#

its as easy as that with maven^^

tardy delta
#

and shade it

humble tulip
tardy delta
#

doesnt

humble tulip
#

it does?

#

default scope is compile

desert tinsel
#

why when I use this method:

public void saveWarpsC() {
        try {
            warpsC.save(warps);
            settingsC.save(settings);
        } catch (IOException e) {
            Bukkit.getConsoleSender().sendMessage("Couldn't save files");
        }
    }``` all my comments disappears?
tardy delta
#

idk lol it didnt shade

#

h2 driver didnt shade automatically too

mortal hare
humble tulip
#

comments disappear

#

sadly, that;s just how it is

#

data files shouldt be configurable anyway

desert tinsel
#

and I can somehow prevent that?

tardy delta
#

i guess you should print the stacktrace too

humble tulip
#

so it shouldnt need comments

desert tinsel
#

oh, sadly ok

craggy spade
#

I need a schedule plugin, so that I can set it up to do a console command every () amount of time, does anybody know of a plugin like this?

humble tulip
craggy spade
#

i need

#

is it easy to code tho?

humble tulip
#

it is easy to code

#

but because it is, someone probably made it already

craggy spade
#

ty

twilit roost
humble tulip
#

are you using a nms biome in a spigot method?

twilit roost
#

yeah?

humble tulip
#

how do u expect that to work?

twilit roost
#

ikr its dumb ๐Ÿ˜„

#

maybe NMS World will have a method for that

humble tulip
#

yeah nms chunk.setbiome

small current
grim oak
river oracle
tardy delta
small current
tardy delta
#

although i'd just write the query myself in the code

river oracle
#

yea probably

twilit roost
#

this looks way too complicated for it to work

humble tulip
#
    public void setBiome(int x, int y, int z, Biome biome) {
        Preconditions.checkArgument(biome != Biome.CUSTOM, "Cannot set the biome to %s", biome);
        Holder<BiomeBase> biomeBase = CraftBlock.biomeToBiomeBase(this.getHandle().s().d(IRegistry.aP), biome);
        this.setBiome(x, y, z, biomeBase);
    }
#

that looks like it's hell to do

humble tulip
twilit roost
#

nah error
didnt assign those things:

grim oak
# twilit roost

i have all my resources located in my src, does it matter if i have a separate folder?

small current
#

Can i make custom biomespecialeffects with custom water and leaf color ?
(What should i change so leaves color will change(

twilit roost
#

resources is located in /src/main

grim oak
humble tulip
#

put it in the src folder

#

Same place and config.yml

twilit roost
ornate patio
#

is there an onEntityMove event or something

#

I need to make all horses take no fall damage

subtle folio
ornate patio
subtle folio
#

check if the entity is a horse and it the type of damage is fall

ornate patio
subtle folio
#

if it is cancel event

small current
twilit roost
#

wdym

#

dm if u need smthing btw

hushed spindle
#

spigot documentation has me spoiled, nms is a bitch to work with

small current
#

Like not making custom biomes

small current
#

Modifying an existing biome

twilit roost
#

ye sure

subtle folio
#

i hate nms so much but itโ€™s kinda hot at times

twilit roost
#

u just set BiomeSpecialEffects to the biome

hushed spindle
#

how do people even figure out how to use it when there is no documentation literally anywhere

subtle folio
#

look at the source code

subtle folio
#

pretty much it

humble tulip
grim oak
#

?paste

undone axleBOT
humble tulip
#

a few years back, so many things nowadays were missing frm the api

ornate patio
weak wasp
ornate patio
#

im still on the hunt to find the villager's finding workstation ai

hushed spindle
#

like im just trying to figure out when a player is left clicking, how do you even begin to look that up

ornate patio
#

i need that

grim oak
hushed spindle
#

im looking at the source code but like most of it is private so i cant even access it

hushed spindle
#

and before you say to use spigot api for that, it doesnt work the way i need it to due to a bug

ornate patio
#

you can make it public

hushed spindle
#

isnt reflection bad for performance

ivory sleet
#

nah

#

it was

ornate patio
#

not really but you also got no other choice

#

i think

ivory sleet
#

but its just inefficient if you're scaling horizontally with it

#

method handles

subtle folio
#

method handles ๐Ÿ˜

ivory sleet
twilit roost
#

ok so now I have f'up biomes

any clues?

int x = p.getLocation().getBlockX();
            int y = p.getLocation().getBlockY();
            int z = p.getLocation().getBlockZ();
            Biome cur = ((CraftWorld)p.getWorld()).getHandle().getBiome(new BlockPos(x,y,z));
            BiomeSpecialEffects eff = IBiomeFactory.getDarkWaterEffects();
            Biome biome = new Biome.BiomeBuilder().specialEffects(eff).precipitation(cur.getPrecipitation()).biomeCategory(cur.getBiomeCategory())
                    .temperature(cur.getBaseTemperature()).temperatureAdjustment(Biome.TemperatureModifier.NONE).downfall(cur.getDownfall()).
                        mobSpawnSettings(cur.getMobSettings()).generationSettings(cur.getGenerationSettings()).build();
            ((CraftWorld)p.getWorld()).getHandle().getChunkAt(new BlockPos(x,y,z)).setBiome(x,y,z,biome);
#

i think Player has joined time or smthing
in ticks so u can /20 and get seconds

#

nvm

ivory sleet
#

zak what are you trying to do

tardy delta
#

check their statistics

#

Player#getStatistic

strange patrol
#

Any idea why gradle is so stupid and looks for the 20220615.101427-27 version instead of the latest one?

tardy delta
#

idk lol

twilit roost
twilit roost
#

wdym register

strange patrol
rough drift
humble tulip
#

"unknown registry element"

ivory sleet
#

no

#

MethodHandle

humble tulip
ivory sleet
#

and VarHandle

#

and LambdaMetaFactory

#

etc

rough drift
#

nobody ever tells me the cool stuff in reflection

#

๐Ÿ˜ข

quaint mantle
ivory sleet
#

well I always try to learn new stuff about the jdk

#

by looking at jeps and classes through javadoc

tardy delta
#

i see

quaint mantle
#

use https://hub.spigotmc.org/nexus/content/repositories/snapshots/

rough drift
#

so methodhandle is speed?