#help-development

1 messages · Page 1390 of 1

long portal
#

xD

#

can you give me a screenshot how i can add buildtools to the pom.xml

#

@mortal hare

fading flume
#

ok in land plugin how do i remove border its like sandstone

mortal hare
#

contact the dev?

long portal
mortal hare
#

not for you

long portal
#

oh sorry

mortal hare
#

what i do, is i download paperspigot purpur or tuinity, run the paperclip until server loads first time

#

then I go to the cache folder

#

and install patched_1.16.x.jar file in to maven local repo

#

but i think there's better way to do that

long portal
#

thats too smart for me

mortal hare
#

there's no other way to get fat jar of spigot on maven repo

#

if it would be

#

Mojang Studios would issue DMCA takedown on the spigot community

#

Since spigot is based around mojang studio's minecraft vanilla server code

#

and its technically their code, and the spigot is just flavour of the server

long portal
#

what are you talking about

mortal hare
#

im saying that you need to install into your own local repo

#

because there's not public one which you can copy paste like other dependencies

cinder thistle
#

run buildtools for that version

#

basically

eternal oxide
#

You only need to run buildtools if you are going to use nms

cinder thistle
#

oh?

#

I've always had to use buildtools period

eternal oxide
#

teh api is public

mortal hare
#

yes

#

i just use paperclip

#

but he's asking how can you put it inside maven dependencies

#

in intellij

long portal
#

can someone just give me the pom.xml i need to have to get BuildTools with Paper

eternal oxide
#

He's asking about paper. This is spigot so I can;t help him with that

mortal hare
#
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
#

use this maven command to install private dependencies into your repo

eternal oxide
#

Or just use spigot and you don;t need any of that

long portal
#

rn

mortal hare
#

Paperspigot is Spigot

eternal oxide
#

No its not

mortal hare
#

Its modified spigot fork which is fork of bukkit

eternal oxide
#

Yes its a fork. It is not Spigot

#

If you need help with paper you need to ask in the paper discord. If you use Spigot we'll help you here.

mortal hare
#

just don't use that plugin at all

#

its not neccessary

long portal
#

Syntaxerror

mortal hare
#

create a new maven project and copy paste maven repo and dependency tags

#

in to your pom.xml

#

and reload maven project

#

and you're good to go

mortal hare
#

that's a command not code

long portal
#

in this little window

mortal hare
#

do you have maven installed

eternal oxide
mortal hare
#

i suggest you watch maven tutorials

#

before getting into maven

#

its really simple

eternal oxide
#

look in the guides section for your IDE

mortal hare
#

im not a teacher

narrow berry
#

hello i have a problem, i created bungeecord servers but i get a message after connecting. [I can't send the screenshot if someone wants to help me. I'll send on a private message, screen] what does that mean?

#

I am writing with a translator, please do not use the shortcut function because the translator does not translate them

mortal hare
#

send it

#

upload to imgur

#

and post it here

long portal
#

its not gradle

#

its maven

mortal hare
#

i mean do you have maven installed on your pc separately

long portal
#

i think

mortal hare
#

input mvn into your command prompt

long portal
#

german

mortal hare
#

its not neccesary to install it, but i hate intellij maven integration of some kind of bullshit tasks

long portal
narrow berry
#

@mortal hare please confirm the invitation to friends so I can send the screen

mortal hare
#

that's how normal maven output looks like

quiet ice
long portal
#

how

mortal hare
#

google "maven"

quiet ice
#

Or if you have, set the path variable into your maven install

long portal
mortal hare
#

yes

quiet ice
#

yep

mortal hare
#

download the maven binaries, extract it somewhere (i like to put it inside program files, just like normal program)

#

then search in start menu enviroment variables of system account

#

and in the "PATH" field add that directory you've just put your maven files in

#

after that reopen cmd.exe once again

#

and try running mvn

minor garnet
#

?paste

queen dragonBOT
minor garnet
#
    public Entity getClosestEntity(Location c, double r){
        Entity centity = null; double cdistance = 0.0;

        for(Entity e : c.getWorld().getEntities()) {
            double distance = e.getLocation().distanceSquared(c);
            if(centity == null || distance < cdistance) cdistance = distance; centity = e;
        } return centity;
    }```
i'm looking for a more efficient method of taking the nearest entity through only one location, I've been researching and ended up finding this method, but apparently it doesn't work very well, it's taking a right arm support
eternal oxide
minor garnet
#

hm

#

i didn't stop to analyze the code

hushed crescent
minor garnet
#

right, so what would I have to do

hushed crescent
#

My events are not registering for some reason

hushed crescent
eternal oxide
hushed crescent
#

It does not though

long portal
#

okay i changed the Project to Spigot

eternal oxide
hushed crescent
#

Grabs all online users and creates a PlayerProfile for them

eternal oxide
#

You have no field for your players you reference in yoru onEnable

hushed crescent
#

Found the error log

#

It can't find the main class.

#

SaplingBoard is the main class though

eternal oxide
#

you also have an index out of bounds error due to tryign to access players array thats nto initialized

#

you have so much broken yrou plugins not even recognised as a plugin

hushed crescent
#

fuck

eternal oxide
#

you main class path is not correct in your plugin.yml

#

InvalidPluginException: Cannot find main class com.synth.tns.SaplingBoard'`

hushed crescent
#

Error occurred while enabling earthday v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "String.length()" because "name" is null

#

ugh

quiet ice
#

At least you use Java 15+

hushed crescent
#

@eternal oxide Is there an easier way testing the plugin without having to manually drag and drop it inside the plugins folder everytime?

eternal oxide
#

yes, add a copy command to yoru startup script of yoru server

quiet ice
#

NPEs can often be found by either using IntelliJ or changing a few settings of Eclipse to make it overly pedantic

hushed crescent
#

ugh forgot

#

no images

#

I have a buildtools folder with the spigot jar

#

Where would the startup script be

long portal
#

where is the java jdk path?

eternal oxide
#

its whatever cmd you use to start your server

hushed crescent
#

I just double click the jar...

long portal
#

the jdk data is not in the C:\Program Files\Java\jdk1.8.0_281

hushed crescent
#

mine is in C:\Program Files\Java\jdk-16

minor garnet
#

guys i'm needing a check to see if the direction that an entity the player is looking at and the opposite of his, how can i do this in a simple way? or if there is already a method for that, I hope that the translator does not disturb me

eternal oxide
#

I'm not sure what you are asking

dense kestrel
#

me either :/

minor garnet
#

the armor stand always when equipped with an item in his hands, always look in one direction, I need to check if the player is looking in the same direction as her

#

and because I'm creating a code to try to simulate as much as possible that the player clicked on that diamond breastplate

eternal oxide
#

Yeah, I'm not following at all

dense kestrel
#

You want code to check if they clicked the item?

hushed crescent
quiet ice
#

You may need to understand class loader order

minor garnet
#

I wanted that if the player clicks on that region the code would work

eternal oxide
#

you tried to access players[0] on an uninitialized array

dense kestrel
#

let me link ya it

minor garnet
#

my case and that I'm taking the nearest entity in that region and if it is an armor stand understand

minor garnet
quiet ice
#

And why does it not work?

minor garnet
#

i will make two codes, one to see if where the player clicked and the location of the armor stand, and another through directions

quiet ice
#

But why can't you use raytrace?

dense kestrel
#

Maybe it doesnt intersect when it hits the entity, no idea though

quiet ice
#

Also, make sure to use the correct raytracing method, not all are the same

minor garnet
#

I use this style of ray trace to pick up where the player clicked

dense kestrel
#

I dont think you can use AABB for that

#

idk though

hushed crescent
gleaming grove
#

@minor garnet spawn that item at armor stand head, and move whole armorstand to block corner

minor garnet
#

and even with the hitbox it wouldn't return the hand hitbox, right

minor garnet
quiet ice
hushed crescent
#

Because it is a Interface?

paper viper
#

Yeah

#

You can't instantiate interfaces

#

Why do you need to make it an array tho?

eternal oxide
#

it is already a player object List, why do you need an aray?

hushed crescent
#

I just want to put the active users to an array

eternal oxide
#

For what reason?

sturdy patrol
#

@minor garnet Mmmmh, it's math.
If you don't care about where the player is clicking precisely you can do something like taking the player head pos, the item pos, substracting one to another to get the vector from the player head to the item. Check if the player is not too far, if it's ok normalize the newly made vector, and then check whether or not the look direction and this vector are similar using a cross product. Like, if the cross product is small, the player is roughly looking at the item.
If you need something more precise, I have made something similar recently, but idk if you really want it since it's real trigonometry x)
You still have to know where the item is placed precisely though

paper viper
#

the bot is dogshit

dense kestrel
paper viper
#

idk why he would want it as a list tho lol

dense kestrel
paper viper
#

collection should be enough

#

xD

dense kestrel
#

figured id send it anyways

quiet ice
#

and it is a copy either way

paper viper
#

Yep

eternal oxide
#

He's only sending a scoreboard so he doesn;t need to store any player objects

dense kestrel
#

oh lol

#

then yea, thats pointless

minor garnet
#

and exactly what I'm trying to do

quiet ice
#

You are storing it somewhere, no?

sturdy patrol
#

Will your item be placed on top of a block @minor garnet ?

dense kestrel
minor garnet
#

although I rotated the hand item to make it lie on the block

quiet ice
#

Otherwise, World#getNearbyEntities

minor garnet
#

wait, what do you mean? @dense kestrel

#

are you saying it is bad to have many armor stands in the world?

dense kestrel
#

Whats the plugin for? Is it for personal use or is it meant to be a public plugin

minor garnet
#

i intend to make it public

dense kestrel
#

I was just saying it may be easier to just hard code the locations of the entities into the plugin

#

oh

#

then nvm

hushed crescent
#

Because it gets all of the users that are online and get's their uuid. Am I oversimplifying this? I thought not storing it removes it on server restart

minor garnet
#

i would use a database for that

quiet ice
#

for (var player : Bukkit.getOnlinePlayers()) {}

paper viper
#

you know you can get the uuids with a stream or a loop

dense kestrel
#
        List<UUID> uuids = new ArrayList<>();
        
        for (Player player : Bukkit.getOnlinePlayers()) {
            uuids.add(player.getUniqueId());
        }
#

there

paper viper
#
Bukkit.getOnlinePlayers().stream().map(Player::getUniqueId).collect(Collectors.toList);
dense kestrel
#

works too XD

paper viper
#

Yeah

dense kestrel
#

i dont do much with stream, i probably should though

paper viper
#

Same. I only use it for reducing broilerplate code

#

but its most useful feature is prolly like parallel streams

dense kestrel
#
    public static Map<UUID, Long> sortHashMap(ConcurrentHashMap<UUID, Long> map) {
        return map.entrySet()
                .stream()
                .sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
    }

This is one of the only times I ever used it XD

paper viper
#

lmfao

#

Dude I used to make that mistake too

#

I used to try and sort a hashmap

#

xD

dense kestrel
#

oof

#

lmao

#

wait

#

why not lol

quiet ice
#

LinkedHashMap can be sorted

paper viper
#

oh wait

#

nvm

#

its LinkedHashMap

dense kestrel
#

that method legit sorts it XD

paper viper
#

I used to make the mistake where I sorted a normal HashMap

dense kestrel
#

ahh

sturdy patrol
#

@minor garnet Well I see one easy way of doing what you want to do:
Use raytrace to get the exact location you are looking at on the block under the item

RayTraceResult r = p.rayTraceBlocks(distance);```
You can print in the chat the place you clicked, and the armor stand position, to know the offset between the armor stand and its hand.
And then, when a player will click a block, you will be able to check all nearby armorstands to know whether the player clicked an area near the armorstand pos + it's hand offset
paper viper
#

that was what i meant

#

lol

hushed crescent
sturdy patrol
#

vinny was I clear, or not? x)

eternal oxide
#

Use their API. Do not directly access the user files.

hushed crescent
#

xdfg hjkop'

#

Damnit

minor garnet
#

@sturdy patrol the problem i am using a 1.12.2 library

#

but it would be interesting for new versions

quiet ice
#

Bukkit had these methods since beta 1.8

long portal
#

Is there a Event if a player enters a chunk?

long portal
quiet ice
#

Okay, a bit of an exageration, but I would not be surprised

hushed crescent
#

Then how can I make this as simple as possible. I just want to add a point to the person on the scoreboard when they place a sapling

dense kestrel
young knoll
#

I mean you can use the move event

hushed crescent
young knoll
#

And just check if the getTo chunk is different from the getFrom chunk

dense kestrel
#

BlockPlaceEvent

#

:/

hushed crescent
#

If I knew how I definitely would

#

oh

#

that

young knoll
#

Minecraft already keeps track of all block placement

sturdy patrol
#

Vinny even in 1.12.2, as long as you can find the offset between the hand and the armorstand, you can use the previous solution, the one with math. It's just a bit less convenient

dense kestrel
#

lol

quiet ice
#

You probably can store the old chunk position in a long (i. e. merge the chunk X and chunk Y into a single number via bit shifting) instead of using UUIDs like I do

dense kestrel
#

NMS

long portal
#

how can i make that if a player is entering a chunk? Please send a Screenshot or something of the Code

dense kestrel
#
    public void sendMessage(Player player, String message) {
        PlayerConnection con = ((CraftPlayer) player).getHandle().playerConnection;
        IChatBaseComponent chat = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + message + "\"}");
        PacketPlayOutChat packet = new PacketPlayOutChat(chat, (byte) 2);
        con.sendPacket(packet);
    }
#

this is for above the xp bar

proven sierra
#

??

dense kestrel
#

i believe, its what i used in the past

quiet ice
#

that is overly done

dense kestrel
#

change the pos

proven sierra
#

or use Player#sendMessage, lol

long portal
#

idk

dense kestrel
#

not in chat

quiet ice
#

p.spigot().sendMessage(ChatMessageType.ACTION_BAR, component);

proven sierra
#

Spigot has it in player

#

yeah

dense kestrel
long portal
#

p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextCompontent("Text")) to send a text

dense kestrel
long portal
#

not loading a new chunk

dense kestrel
#

ok, one min

long portal
#

thx

quiet ice
#

PlayerMoveEvent has these methods

eternal oxide
#
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onPlayerMove(PlayerMoveEvent event) {

        /*
         * Abort if we havn't really moved
         */
        if (event.getFrom().getWorld() == event.getTo().getWorld()
                && event.getFrom().getBlockX() == event.getTo().getBlockX()
                && event.getFrom().getBlockZ() == event.getTo().getBlockZ()
                && event.getFrom().getBlockY() == event.getTo().getBlockY())
            return;
#

that will abort out if the player hasn;t moved a full block. Adjust that to check chunk

quiet ice
#

It is just a bit of maths (just a bit of bit shifting) to convert the block X/Z to Chunk positions

cedar hamlet
#

ok, im being stupid but, how do i call another class from main?

long portal
#

you a faster than @dense kestrel lmao

dense kestrel
#

:/

long portal
#

xD

dense kestrel
#

I was just gonna load up the Factions Fork i work on and send ya it from that XD

cedar hamlet
#
public class AOTE implements Listener{
    @EventHandler
    
    public void ballFiring(PlayerInteractEvent e){
          System.out.println("Test");
        Player p = e.getPlayer();
        if (!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
        if (!(e.getItem().getType() == Material.BLAZE_ROD)) return;
        if(!p.hasPermission("example.example")) return;
      
        Fireball s = e.getPlayer().launchProjectile(Fireball.class);
    }

}
cedar hamlet
#

I have this in a seperate class than main

dense kestrel
#

nice

cedar hamlet
#

but it doesnt do anything

dense kestrel
#

😮

eternal oxide
#

I'm not writing it for you, I just showed you how to do it.

long portal
#
    public void onPlayerMove(PlayerMoveEvent event) {

        /*
         * Abort if we havn't really moved
         */
        if (event.getFrom().getWorld() == event.getTo().getWorld()
                && event.getFrom().getBlockX() == event.getTo().getBlockX()
                && event.getFrom().getBlockZ() == event.getTo().getBlockZ()
                && event.getFrom().getBlockY() == event.getTo().getBlockY())
            return;
        
        
        // There?
    }```
quiet ice
#

@EventHandler

#

Seriously, there is only one class type it belongs to

dense kestrel
#
    @EventHandler
    public void ballFiring(PlayerInteractEvent e){
        System.out.println("Test");
        Player p = e.getPlayer();
        if (!(e.getAction().equals(Action.RIGHT_CLICK_AIR))) return;
        if (!(e.getItem().getType().equals(Material.BLAZE_ROD))) return;
        if(!p.hasPermission("example.example")) return;

        e.getPlayer().launchProjectile(Fireball.class);
    }
#

there

#

@cedar hamlet

long portal
#

i understand java and Bukkit but i dont know your code

#

@eternal oxide

cedar hamlet
#

what did you do?

dense kestrel
#

Why did you have Fireball ball = ?

quiet ice
#

@EventHandler annotated methods always belong in a class that implements Listener

cedar hamlet
#

idk, not my code

#

im not the best programmer

dense kestrel
#

try that

#

tell me if it works

#

if it doesnt ill take a second look

cedar hamlet
#

it still does nothing

dense kestrel
#

also use .equals() unless youre comparing primitives

#

ok, let me look

cedar hamlet
#

the thing is console doesnt say anything about "test"

dense kestrel
#

Did you register the event?

gleaming grove
#

have you register the event?>

dense kestrel
#

:/

cedar hamlet
#

i uh

#

dont know what that means :c

dense kestrel
#
getServer().getPluginManager().registerEvents(new AOTE(), this);
long portal
#

Can someone else please explain me how to do this with the Chunks

dense kestrel
#

put that in your onEnable()

#

@cedar hamlet

cedar hamlet
#

ok

long portal
dense kestrel
#

ok, let me look again

cedar hamlet
#

it works now!

#

tty!

dense kestrel
#

np lol

long portal
#
if(event.getFrom().getChunk() != event.getTo().getChunk()){
            
        }

maybe this?

high pewter
#

Is there any way to properly replicate the way datapacks are able to change block/entity loot? This code works but has many, many loopholes and issues```java
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (event.isDropItems() && event.getPlayer().getGameMode() != GameMode.CREATIVE) {
event.setDropItems(false);
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), new ItemStack(Material.ACACIA_BOAT));
}
}

@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
    event.getDrops().clear();
    event.getDrops().add(new ItemStack(Material.ACACIA_BOAT));
}```
dense kestrel
long portal
#

oh

quiet ice
#

use Object#equals() ffs

dense kestrel
#

😛

long portal
#

and if it doesnt i'll do "getChunkKey"

#

maybe

dense kestrel
#

idk that that is

#

lol

quiet ice
#

what is that?

long portal
#

IT WORKED

#

YES

#

I LOVE YOU

dense kestrel
#

XD

long portal
#

not really

#

but

#

YES

dense kestrel
#

I love you more baby

#

full homo

long portal
#

ohhyeea

sharp bough
#
                            
                        }```
why do i get an error there, i want to get the next int, and if its null then do something
#

should i use a try and check if i get null do something?

floral kindle
sharp bough
#

if i put an int instead im fine

#

if((ChestDragonDrop.get().getConfig().getInt("tiers." + j + "items." + (itemsCount + 1))) == 1)

#

like that

quiet ice
#

#has?

sharp bough
#

but i dont want to do that

quiet ice
#

primitives can never be null

dense kestrel
#

ints cant be null i dont think

quiet ice
#

that's the thing I love in them

dense kestrel
#

try

if((ChestDragonDrop.get().getConfig().get("tiers." + j + "items." + (itemsCount + 1))) == null){
        //Code!!!
}
#

@sharp bough

sharp bough
#

yea that works

dense kestrel
#

😄

quiet ice
#

Just note that it will not do an int cast

dense kestrel
#

damn it

#

i spilled my fuckin water

#

:/

mortal hare
#

I have this simple question. Its more a java question but here it is. Imagine i have a Class with an object inside the field. There's getter method which i use inside async task. if i get the object reference through the getter and the class changes the field's reference to another object i will still have the old object inside the exeution thread, right? I think so, since JVM garbage collection sleeps until the last reference of an object exists, and that reference is in local runnable variable.

long portal
#

Is there a Bukkit thing for like

Bukkit.getEveryPotionEffectType

mortal hare
#

why would you want that

long portal
#

i dont wanna add every potion effect by myself

#

xD

dense kestrel
#

ummm

mortal hare
#

PotionEffectType.values()

long portal
#

thx

dense kestrel
#

lol

mortal hare
#

enum classes have internal values() method to get all enums

dense kestrel
long portal
#

List<PotionEffectType[]> effectTypes = new ArrayList<>();

            effectTypes.add(PotionEffectType.values());
dense kestrel
#

why is that so big

#

tf

long portal
#

for a random potioneffecttype

mortal hare
#

why are you adding array to the list

long portal
#

for a Challenge

mortal hare
#

you don't need array inside the list

#

you can generate random number

#

from 0 to array.length

sharp moat
#

ThreadLocalRandom.current().nextInt(0, max+1)

#

so int random = ^

dense kestrel
# long portal for a Challenge
        for (PotionEffectType effect : PotionEffectType.values()) {
            player.addPotionEffect(new PotionEffect(effect,time,amplifier));
        }
sharp moat
#

I was wondering does anyone know how I could create a fileball to bounce a player? In the same way that if you are next to TNT it pushes you in a certain direction?

mortal hare
#
PotionEffectType[] effectTypes = PotionEffectType.values();
int random = ThreadLocalRandom.current().nextInt(0,  effectType.length+1);

PotionEffectType randomSelectedEffect = effectTypes[random];
dense kestrel
#

ohh he said random

#

i thought he wanted them all at once XD

mortal hare
#

yea he said it both

#

🤔

dense kestrel
#

well, now he has both

mortal hare
#

also, i wouldnt use enhanced for loop for this. it uses iterator which can give small performance decrease instead of iterating with .get()

#

but its performance vs readability

#

it costs little to nothing

sharp moat
#

does anyone know how to do what I wrote?

long portal
mortal hare
#

if it collides change its velocity vector by multiplying it to -1, it would invert the vector

dense kestrel
long portal
#

☺️

#

This emoji is disgusting

dense kestrel
long portal
#

D:

#

🥺

dense kestrel
#

eww

long portal
#

sooo disgusting

sharp moat
#

I know this sounds stupid but what is paperspigot? Should I be using it over spigot?

long portal
#

Paper is better

#

because more features

dense kestrel
long portal
#

and better performance

mortal hare
#

paperspigot is better but don't mention it here because md_5 will be biggie maddie here

sharp moat
#

Ah

mortal hare
#

purpur is even better

dense kestrel
#

ConsiderSpigot on top!

mortal hare
#

Purpur or Airplane is the best

#

But nowadays Purpur includes airplane's patches

#

so meh

#

i prefer stability of purpur

mortal hare
# long portal for this

yes that's correct but you could remove else return; in the back since its not doing anything whatsover only eating your HDD or SSD size

#

if first statement fails it just exits out the outer statement, thus still returns void.

#

also use ThreadLocalRandom instead of new Random() since you don't need to create new object on heap, thus it saves you cycles, because your thread can generate your random number

long portal
#

okay

#

thanks

#

what is the PotionEffectType for INSTANT_DAMAGE

#

HARM?

mortal hare
#

its the splash potion effect which reduces specific amount of damage no matter what

#

idk the name but it exists ingame

#

check creative mode

#

yes i think its harm

long portal
#

nope

#

its not direct damage

mortal hare
long portal
#

why isnt it working

mortal hare
#

why im getting this kick message whenever i tried to send windowclick packet

long portal
#

SHIT

#

I DID &&

#

not ||

#

im dumb

novel lodge
#

How can I spawn a falling block with block data

long portal
#

player.getWorld().spawnFallingBlock()

#

or wdym

novel lodge
#

How do I get the block data because it can't be instantiated

mortal hare
#

Cool tip for those who don't know: if you're wanna know if the number is odd, do bitwise AND and check if the result is 1

int number = 101;
boolean isOdd = number & 0x1 == 0x1;
lunar schooner
#

Hey there, could anyone point me in the right direction as to where the ClassLoader for plugins is kept? (as in, in which class, and maybe even which Field :"D )

mortal hare
#

#AnyLoadedPluginObject.getClass().getClassLoader()?

#

@lunar schooner

lunar schooner
#

oh damn, totally forgot about that O.o

#

Cool

mortal hare
#

by using that you can load internal files from the plugin's jar file

weak adder
#
    @EventHandler
    public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
        if(event.getEntityType() == EntityType.COW);
        event.setCancelled(true);
        if(EntityDamageEvent.DamageCause instanceof Player) {
            event.setCancelled(true);
        }```
So Im trying to do is when and cow is killed by a player (Other Entitys can hurt cows) it is set to cancelled
dense kestrel
#

umm

weak adder
#

wait

dense kestrel
#

how would EntityDamageEvent.DamageCause be a Player

#

ever

mortal hare
#
@EventHandler
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
  if (event.getEntityType() == EntityType.COW) {
    event.setCancelled(true);
  }
}
lunar schooner
mortal hare
#

you don't need that

#

if its loaded

lunar schooner
#

the JNIEnv pointer isn't sharable across threads,

mortal hare
#

its only used if the plugin is not loaded at all

weak adder
#

I want to send message in the chat saying "you cannot hurt cows" after hurting the cow

lunar schooner
#

and if I do let env = jvm.attach_current_thread().unwrap();, and then do env.findClass("org.bukkit.Bukkit"), thatll spit a ClassNotFound in my face :"D

#

(JavaVM object is sharable accross threads)

mortal hare
#

just add the plugin as dependency in plugin.yml and import it inside

dense kestrel
lunar schooner
mortal hare
#

i thought that was kotlin lol

lunar schooner
#

Nope, it's rust 😄

mortal hare
#

what are you're doing anyways

weak adder
dense kestrel
#

np

lunar schooner
#

So I dont like Spring boot--at all

#

so I'm using Actix Web, which is a web server written in Rust

mortal hare
#

and why you're loading plugins via webserver

lunar schooner
lunar schooner
#

I'm not loading plugins, no

#

I need to access a method in Bukkit or in my plugin, so I need it's classloader

#

then i can call findClass on that ClassLoader

mortal hare
#

so you wanna call method through the webserver of a plugins class

lunar schooner
#

This was my little test, without the classloader:```rs
let jvm = env.get_java_vm().unwrap();
let env_test = jvm.attach_current_thread().unwrap();
let bukkit_jclass = env_test.find_class("org.bukkit.Bukkit").expect("Unable to find class org.bukkit.Bukkit");
let console_sender_jobject = env_test.call_static_method(bukkit_jclass, "getConsoleSender", "()Lorg/bukkit/command/ConsoleCommandSender;", &[]).expect("Unable to create org.bukkit.command.ConsoleCommandSender.");
let _ = env_test.call_static_method(bukkit_jclass, "dispatchCommand", "(Lorg/bukkit/command/ConsoleCommandSender;Ljava/lang/String)Z", &[console_sender_jobject, str_to_jvalue(&env_test, "tps")]);

Which does not work
mortal hare
#

i don't understand rust

#

but looks like node js

#

a bit.

lunar schooner
#

yeah its a bit like JS in some ways

mortal hare
#

i should give rust a try sometime

lunar schooner
#

But way more powerful :"D

#

Oh man it is amazing 😄

#

Even JNI (java's native interface) isnt bad!

mortal hare
#

your code is beyond my understanding i didn't knew you can access jvm by some vodoo magic of rust

sharp moat
#

im still stuck on this bounce player crap it's killin me

mortal hare
lunar schooner
#

JNI is a piece of magic beyond my understanding of how it works, but I do know how to work with it

mortal hare
#

scroll

sharp moat
#

im on spigot tho not paperspigot

cedar hamlet
#

Is there a way to detect the blocks in front Of you? (I’m trying to make a teleporting Wand and I don’t want the player to teleport into a block)

mortal hare
#

there's no way to do that on spigot

#

unless you edit the spigot's code

#

or do some reflection magic

lunar schooner
#

protected native static void startWebServer(String configFilePath, String databaseFilePath, String staticFilePath); this is one of my Javamethods. Using javac -h . <path to class>, I can generate a C header file from it, from which I can then construct the following Rust function: ```rs
pub extern "system" fn Java_nl_thedutchmc_rconsole_webserver_Native_startWebServer(env: JNIEnv, _class: JClass, config_file_path_jstring: JString, database_file_path_jstring: JString, static_files_path_jstring: JString) {

sharp moat
#

well crap

#

should I just swich to Paper Spigot then?

dense kestrel
mortal hare
#

if you want this kind of feature be implemented easily then yes

#

if you want the hard way

lunar schooner
#

The JNIEnv object provided there would grant me access to Java functions, but it is very much not sharable accross threads, so I can get the JVM from that, which is, but to then access the loaded classes I need the classloader, which is where my original question came from

mortal hare
#

then you can stick it and implement the event yourself

mortal hare
lunar schooner
#

Understandable :"D

mortal hare
lunar schooner
#

JNI is kindof a hot mess

#

But it's fun to play with

mortal hare
lunar schooner
#

because the things I'm doing rn in Java would be so much slower :"D

mortal hare
#

yea

lunar schooner
#

(well, 'so much', we're talking mili, probably nanoseconds, but oh well)

dense kestrel
# cedar hamlet Wdym
@EventHandler
public void onMove(PlayerMoveEvent event) {
//Get the block in front of them
}
sharp moat
#

I might switch to Paper then sounds better ngl

cedar hamlet
#

oh no

#

im asking how to do the comment

vital ridge
#

Yo, is this a 5% spawn chance?

int spawnChance = new Random().nextInt(100) + 1;

                if (spawnChance <= 5) {
                    
                    System.out.println(spawnChance);

                    WorldServer world = ((CraftWorld) ev.getHitEntity().getLocation().getWorld()).getHandle();

                    world.addEntity(cbc);

                }
dense kestrel
#

comment?

vital ridge
#

i tried it, but cant tell

cedar hamlet
#

//Get the block in front of them

mortal hare
#

yes

cedar hamlet
#

Let me do some sudo

mortal hare
#

this is 5% out of 100%

dense kestrel
#

🙃

vital ridge
#

aight, thanks.

sharp moat
#

if I switch the external archieve to Paper will it screw up my code?

dense kestrel
#

ok, one sec

#

block in front on the ground? eye level? or

cedar hamlet
#

i dont want the player to be inside a block

#

when they teleport

dense kestrel
#

ok here

#

one sec

mortal hare
#

wait

#

i might be wrong

cedar hamlet
#
if !block(x+5,y,z){
teleport();
}
dense kestrel
#

sec

cedar hamlet
#

ok

sharp moat
#

@mortal hare I cannot seem to find the download for paper 1.8?

mortal hare
cedar hamlet
#

why does that exist

sharp moat
#

nbm found it

#

lmao

#

Most people play on 1.8.8 still I swear

dense kestrel
# cedar hamlet ok
    @EventHandler
    public void onTeleport(PlayerTeleportEvent event) {
        if (!event.getTo().getBlock().getType().isTransparent()) {
            event.setCancelled(true);
        } else if (!event.getTo().getBlock().getLocation().add(0,1,0).getBlock().getType().isTransparent()) {
            event.setCancelled(true);
        }
    }

Something like this should work just fine

sharp moat
#

so developing on there seems best lol

glass sparrow
#

choosing to develop on old versions is not the best

#

i see why you do it but its not very smart

sharp moat
#

yeah I get that

mortal hare
#

spigot api on 1.8.8 lacks basic things

#

like send titiles actionbars

sharp moat
#

^ true

#

but still

dense kestrel
glass sparrow
#

that is the only pull factor

dense kestrel
#

and cannons

mortal hare
#

Whole fucking nether update, armor, tools, blocks > clicking with epileptic fingers.

dense kestrel
mortal hare
#

community needs to adapt

#

it breaks

#

because no one wants to port it properly

cedar hamlet
#

wow

sharp moat
#

people hate the 1.9+ fight mechanics

dense kestrel
#

Cannons like this break past 1.8.8 (The Jars cant handle them and crash with em)

cedar hamlet
#

@dense kestrel that works flawlessly

dense kestrel
mortal hare
#

nvm

#

i think i know why

dense kestrel
#

lol

mortal hare
#

im sending the serverbound packet

#

to the player

novel lodge
#

What event checks if an entity lands

#

Or hits a wall

dense kestrel
novel lodge
#

ok

mortal hare
#

if it stops changing

#

he's standing still

#

if you want jump event

#

there's statistic increase event

#

from which you can get jump count

#

if it has been increased

#

cancel the event and pull it down with velocity change

earnest junco
eternal oxide
#

I wonder what the player distribution is.

dense kestrel
#

Most players are gonna be on 1.8.8 clients

#

even if most servers are above 1.8.8

glass sparrow
#

arguable

#

for pvp servers, yes, for any others, probably not

dense kestrel
#

because most of those ones are random survival servers with 2 or 3 players

mortal hare
#

i don't get it why most of the servers use 1.16.5 but use java 8

lunar schooner
#

Id love to port Factions, if only I had time :/

mortal hare
#

its a free real estate

eternal oxide
#

There are actually no figures on that, 6-8% of servers are 1.8 but unknown player counts

mortal hare
#

15% performance increase for just upgrading

lunar schooner
mortal hare
#

i've dropped it too

lunar schooner
#

Switch to java 11 or get lost is my thought :"D

mortal hare
#

java 11 is also way better in terms of performance

eternal oxide
#

I'll drop it when MC drops it

lunar schooner
#

PaperSpigot already dropped it right?

mortal hare
#

its deprecated

#

on purpur

#

so i don't think so

#

only the warning message pops up

#

if you're running on java 8

lunar schooner
#

Yeah fair enough

#

Might be dropped any time then 😄

#

Main reason I stopped doing java 8 is because my entire pipeline is java 11 now, Minecraft was the last and only java 8 thing

mortal hare
#

for it was the reason that i own the server and i running in better jvm is way more efficient than developing in older, slower jvm

lunar schooner
#

I just didnt feel like switching JDKs every 2 hours 😂

#

On linux its fine, update-alternatives and you're done, but Windows you gotta go change the env var, and restart your IDE and terminals :/

mortal hare
#

if i had some plugins on spigotmc i would probably not support java 8 still

#

eh

#

you can always specify the javaw path

#

to the executable

#

🤔

lunar schooner
lunar schooner
#

In other terms, is there any chance anyone knows how to make a native panic not crash the JVM? I doubt anyone's got clues, but no harm in trying 😅

mortal hare
#

i doubt somehere would know

#

try other programming discords maybe?

latent depot
#

Hi is there any good multi world plugins for 1.16?

lunar schooner
#

Hm yeah ill give that a go

mortal hare
#

RXWorld @latent depot

#

Multiverse-Core

latent depot
#

Thank you

lunar schooner
#

Because this is getting old, lol

cold field
#

Guys, I need to know in which version the TabCompleter was introduced. Where can I found by myself this info, so next time I won't ask

mortal hare
#

tab completion is very old

#

auto completion isnt

#

1.8-1.16.5 for sure

#

maybe 1.7

eternal night
#

The TabCompleter was introduced in 9fd9767a4a55c90bf488e2077123be8a55aaa982 which dates back to 09/10/2021

#

so like

#

basically since conception

mortal hare
#

oh

cold field
#

Where can I found this info?

mortal hare
#

i misunderstood the question

eternal night
#

The Bukkit git history

cold field
#

Ok thanks

lunar schooner
eternal night
#

oh

#

YIKES

#

2012

#
commit 9fd9767a4a55c90bf488e2077123be8a55aaa982
Author: Score_Under <seejay.11@gmail.com>
Date:   Tue Oct 9 14:54:12 2012 -0500

Add tab-completion API. Fixes BUKKIT-2181. Adds BUKKIT-2602
#

is the commit it was first introduced

#

or maybe it is in the future 🤔

lunar schooner
#

Hm this is interesting, is class a field of a class?

#

I tried calling getClassLoader, which apparently isn't a static method.

quaint mantle
#

What does || mean? is it like and or or?

eternal night
#

.class it is syntactic sugar

lunar schooner
#

so I cant do Bukkit.getClassLoader(), but I can do Bukkit.class.getClassLoader(), so does that makeclass a field?

lunar schooner
eternal night
#

well it is really a keyword

quaint mantle
#

ah ok thx

lunar schooner
#

Then how the hell do I call getClassLoader 🤔

quaint mantle
lunar schooner
#

yep, &&

eternal night
#

Bukkit.class.getClassLoader ?

lunar schooner
#

well, from native code 😅

eternal night
#

that might have been a great piece of information xD

quaint mantle
#

Thanks! :)

lunar schooner
#

This doent do it env.call_static_method(bukkit_jclass, "getClassLoader", "()Ljava/lang/ClassLoader;", &[]) lol

#

since, apparnently, getClassLoader isnt a static method

eternal night
#

No it is a non-static method on the Class instance

#

Hmm

lunar schooner
#

yet I can call it without having an instance of the Class

eternal night
#

what ?

#

no you can't

lunar schooner
#

which doesnt create an instance of String, as far as I know

eternal night
#

Yes, internally that is resolved to the managed class instance for the String class

#

your class loader maintains that instance

lunar schooner
#

Issue: I dont have a classloader XD

eternal night
#

isn't there FindClass or something

#

ooof it has been ages

lunar schooner
#

well, to call findClass you need a classloader

lunar schooner
eternal night
#

question at some point really becomes, why the hell do you need a class loader inside a native function xD

lunar schooner
#

to call functions in Java :"D

eternal night
#

did that change it so much o.O I can't recall having to do that

lunar schooner
#

^without a JNIEnv object, since that doesnt implement Send and Sync, so I cant send it across Thread boundries

eternal night
#

OH

#

okay there we go xD

lunar schooner
#

I can send the JavaVM object across thread boundries, and then call jvm.attach_current_thread(), but that comes only with the bootstrap classloader, not even the system classloader

#

so I need to also ship a classloader around :"D

latent depot
#

Hi so I have multiverse-core but how do i make it so where each world has a different inventory

lunar schooner
#

....not sure how though, since Im not sure if _jobject implements Sync and Send 🤔

trail oriole
#

How do i remove an item from someone's inventory ?

lunar schooner
#

removeItem() would work too

trail oriole
#

thanks

eternal night
#

google works wonders for questions like this btw

#

concerning how simple they are

lunar schooner
#

ayy, this works, cool ```rs
//Get the Bukkit class and it's classloader from the original JNIEnv
let bukkit_jclass = env.find_class("org/bukkit/Bukkit").expect("Unable to find class org.bukkit.Bukkit");
let bukkit_obj_class_jclass = env.get_object_class(bukkit_jclass).unwrap();
let bukkit_class_loader = env.call_method(bukkit_obj_class_jclass, "getClassLoader", "()Ljava/lang/ClassLoader;", &[]).expect("Unable to get org.bukkit.Bukkit's ClassLoader");

eternal night
#

just wrap it all in unsafe next time :>

lunar schooner
#

If I can avoid it, nope :"D

eternal night
#

yeah please don't xD

lunar schooner
#

I'd rather stick it in an Arc<Mutex<>> :"D

eternal night
#

didn't know the rust bindings were that advanced already tho

lunar schooner
#

mut static is a big no lol

eternal night
#

neat

lunar schooner
#

Including lifetime support too!

#

so I apparently also need to ship a JValue for java.lang.String around 🤔 the bootstrap classloader doesnt know where to find it

#

and without a string, you cant find other classes, since findClass takes a String

#

...nope that is not the issue, the classloader magically turned into a nullpointer, bollocks.

mortal hare
#

is there any NMS method to update the whole inventoryview

#

nvm

#

i found API method

lunar schooner
#

uh, probably, use jdgui and find the inventory view class

mortal hare
#

tried to find one but can't seem to find in a playerinventoryclass

#

anyways

#

there's API method

lunar schooner
#

oh, even better :"D

mortal hare
#

yeah

#

no slow reflection

lunar schooner
#

I mean, reflection is only noticeably slow if its poorly thought out :"D

#

Like e.g getting the Fields and Methods every time, rather than doing it statically

mortal hare
#

does .get() method cost anything?

#

of field reflection api

lunar schooner
#

Everything costs something of course :"D

#

Not sure how much, never measured it but

mortal hare
#

i wonder if its very intensive

lunar schooner
#

This is how I do it when I need to do reflection:

private static Constructor<?> pluginCommandConstructor;
    private static CommandMap commandMap;
    private static SimplePluginManager pluginManager;
    static {
        Field commandMapField;
        try {
            commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
            commandMapField.setAccessible(true);
            
            commandMap = (CommandMap) commandMapField.get(Bukkit.getServer());
            
            pluginCommandConstructor = org.bukkit.command.PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);
            pluginCommandConstructor.setAccessible(true);
            
            Field simplePluginManagerField = Bukkit.getServer().getClass().getDeclaredField("pluginManager");
            simplePluginManagerField.setAccessible(true);
            
            pluginManager = (SimplePluginManager) simplePluginManagerField.get(Bukkit.getServer());
mortal hare
#

literally the same lol :"D

lunar schooner
#

another advantage, smaller methods (yes I know the exceptions handling needs to be done)

cold field
#

Ouch, Am I supposed to do reflection as you guys?

lunar schooner
#

Not if there's an API for it 😄

#

Only use reflection when you cannot use the API

mortal hare
#

Its vodoo magic. Well i sometimes abuse craft classes since those are more performance friendly

#

but that breaks backwards compatibility

lunar schooner
#

The reflection I'm doing in my project is kindof unneccessary actually

#

I dont want to have to declare commands and permissions in plugin.yml, so I do it with reflection 😂

cold field
#

ahahhaha

mortal hare
#

i have dedicated command system

lunar schooner
#

yup same

mortal hare
#

which registers them via builders

#

and it enables to have realtime autocompletion

#

without having it to prebake it

lunar schooner
#

this is what I do rn

#

But Im not entirely happy with it yet

mortal hare
lunar schooner
#

like the second string can be replaced with plugin.getName()

mortal hare
#

although this dependant on purpur

#

i might sometime backport it to paperspigot

#

since paperspigot handles commands differently

#

it uses vanillacommand dispatcher instead of datapack command dispatcher

#

from brigadier

lunar schooner
#

I dont use any dependencies, so if paperspigot does it differently, then my plugin probably doesnt work there :"D

mortal hare
#

uhh so annoying

#

why window items packets requires constructor of their dependant list implementation

#

and then copies the contents to normal list

#

instead of passing the reference to it

lunar schooner
cold field
#

What it is brigadier? Is it like a commandManager?

mortal hare
#

its internal mojang command parser

#

basically vanilla minecraft commands

lunar schooner
#

oeh I should dig into that

mortal hare
#

it handles all the autocompletion and the parsing of command arguments

cold field
#

uhm i assume that my command Manager project can go into the trash

mortal hare
#

its very flexible

#

i mean

#

the thing is

#

spigot doesn't use brigadier properly

#

you need to create your own command dispatcher of brigadier

#

since spigot overrides the main one

#

as far as i know

cold field
#

How it handles subCommands?

mortal hare
#

like a nodes

#

its very expansive for sub commands

#

it can have autocompletion without you providing the prebaked arguments

cold field
#

wow

#

I throw away hours of work

#

ahahah

mortal hare
#

yea my command manager does that too, but its very inefficient because it wraps around the bukkit command api instead of mapping the brigadier itself

quaint mantle
#

Can you cancel a event from a different class?

mortal hare
#

and bukkit doesn't clean up brigadier nodes after itself

#

if you unregister command through the methods

#

it leaves the tab completion inside the brigadier

cold field
#

should I keep my command manager or should I switch to brigadier?

mortal hare
#

keep it

#

it would break backwards compatibility

#

and would require lots of work to get it working

cold field
#

ookk. I'm happy

quaint mantle
#

oh nvm

#

lmao

ivory sleet
#

I mean you just delegate the desired class to cancel the event instance

mortal hare
#

callback to the method from the listener

#

or listen to the event

#

through listener api

quaint mantle
#

yes thx :)

kind coral
ivory sleet
#

looks good

#

though its somewhat incompatible with spigot dark theme

mortal hare
#

how is that possible???

#

oh

#

you abuse education edition skins 😄

kind coral
#

i was first in the world to make that OWO

mortal hare
#

i wonder what education edition features you can abuse?

kind coral
lunar schooner
#

I didnt even know education edition was a thing

novel hornet
#

So i'm new to coding plugins and i want to ask you how would make a entity move in a direction like a fireball

kind coral
#

idk tho if you put an animated gif as head texture. will it work.

novel hornet
#

kinda

kind coral
#

you just need basics at the end if you do simple stuff

mortal hare
#

well you can abuse this to create custom blocks via armor stands without any modpacks!

kind coral
kind coral
mortal hare
#

i would gladly pay 30$ for education edition access

#

its really fucking rare

mortal hare
#

just for this

#

how can you get access to this edition

#

i think only schools can give you this

kind coral
#

make a microsoft account

#

and register as a teacher

#

nah

mortal hare
#

really?

#

bruh

kind coral
#

y

mortal hare
#

lets go

lunar schooner
#

O.o

kind coral
#

you can either make a student one

lunar schooner
#

I need to look into this

mortal hare
#

if you can load hd player heads

kind coral
mortal hare
#

you can load hd player skins!

kind coral
#

so you can take a dive into the code

lunar schooner
#

yep definitely planning to

#

super curious how it's insides work :"D

kind coral
mortal hare
#

this idea of abusing education edition will blow up

#

ngl

lunar schooner
novel hornet
kind coral
kind coral
lunar schooner
#

I might do some work to get rid of ```kava
public static TransparentHeads getInstance() {
return instance;
}

kind coral
#

for Libs

lunar schooner
#

Libs what?

kind coral
#

like if i want to get the head with another plugin

lunar schooner
#

ah like that

mortal hare
#

yeah

kind coral
#

i just get the instance of theads and just get the methods

mortal hare
#

or use service API

#

Bukkit has services API which no one literally uses 😄

#

except me, worlguard and vault ;S

lunar schooner
#

could always do some funny business with like e.g public static void apiHook(<forgot what the Function class looks like> callback)

mortal hare
#

that's outside bukkit conventions

lunar schooner
#

Neither is JNI 😂

#

@kind coral Is there a reason you dont use something like Gson for serialization?

mortal hare
#

@lunar schooner cmon man, do a mineskin like api

#

for education edition

#

ik you can do it 😄

lunar schooner
#

👀

#

I definitely can

#

pretty easy probably

mortal hare
#

we need a farm of education edition accounts

kind coral
lunar schooner
#

Considering it's free

lunar schooner
mortal hare
#

you don't even need premium account to upload normal skins anymore

#

mineskin should migrate to education edition accounts

lunar schooner
#

Take part of my configuration class:

public class ConfigObject {
    private boolean debugMode, useWebServer;
    private int listenPort;
    private TokenObject[] tokens;
#

You'd serialize this like new Gson().toJson(configObjectm ConfigObject.class);

mortal hare
#

and it returns a string or a map?

lunar schooner
mortal hare
#

considering that its included inside spigot

#

i would gladly take this.

lunar schooner
#

Deserialization is similar: new Gson().fromJson(String, ConfigObject.class)

mortal hare
#

if only something like this existed for yaml files

#

i mean there are

#

but

lunar schooner
#

snakeYAML somewhat exists

mortal hare
#

not as easy as gson

#

yea

lunar schooner
#

I do some hacky stuff for yaml

mortal hare
#

but snakeyaml is way harder to parse

lunar schooner
#
        final Yaml yaml = new Yaml();
        final Gson gson = new Gson();

        Object loadedYaml;
        try {
            loadedYaml = yaml.load(new FileReader(configFile));
        } catch(FileNotFoundException e) {
            return;
        }

        String json = gson.toJson(loadedYaml, java.util.LinkedHashMap.class);        
        this.configObj = gson.fromJson(json, ConfigObject.class);
#

Easy 😂

#

Yaml -> Object -> Json -> Object 😂

lunar schooner
#

I much prefer the Rust way, it's got one cohesive system (known as serde) for doing (de)serialization

#

works with most things, like XML, JSON, Yaml etc

mortal hare
#

but it works

lunar schooner
#

But it works like a charm!

kind coral
#

oh, i was also planning on adding heads via game giving it a proper syntax, sadly i can't get it to work without breaking the config

#

since using getConfig()#set() will actually break everything also when using saving the resource

lunar schooner
#

so this is yaml deserialization in Rust, for comparison:

#[derive(Serialize, Deserialize, Clone)]
pub struct Config {
    pub port:   u32,
    pub pepper: String,
}
...
let config = serde_yaml::from_str::<Config>(&config_file_content);
mortal hare
#

rust looks like c++ had a child with js

lunar schooner
#

all you have to do for Serialization and deserialization is derive the Serialize and Deserialize traits respectively

#

I mean, it sortof has, more TS though

#

its a low level language, but as easy as a high level one like JS

#

I find it is also incredibly difficult to introduce bugs

#

things like race conditions are just basically not possible

mortal hare
#

is it interpreted

#

or compiled?

lunar schooner
#

nope, compiled

lunar schooner
#

There's currently an RFC to allow Rust in the Linux kernel, which is currently only really C

#

Torvalds called it 'not terrible', which knowing him is damn good 😂

eternal night
#

how bad is jni overhead when calling methods btw ? do you happen to know that

lunar schooner
#

Its not that bad

eternal night
#

like, bytecode methods

kind coral
#

guys wanna see the devil?

lunar schooner
#

I havent really looked at the bytecode of a method with a native modifier

eternal night
#

no no like,

#

how much overhead from calling a java method from native

#

the stuff you were attempting to do before

kind coral
lunar schooner
#

ah, basically as much as reflection

#

because essentially, that's what you're doing

eternal night
#

I mean, you also move off of native stack onto jvm virtual stack for the call

#

which is what I expected to be the overhead

mortal hare
#

i use vs code theme

#

for intellij

#

it works pretty well

#

for my eyes

glass sparrow
#

one dark pro theme on top #1

lunar schooner
#

yeah true, but I've noticed that my commands basically return instantly, which includes db lookups and whatnot

#

I should run Flamegraph on it

mortal hare
#

one dark is bit blurry for my eyes ,idk why

lunar schooner
#

with perf^^

glass sparrow
#

i use one dark for every ide i have

lunar schooner
#

So since we're also on the topic of themes etc, I can highly recommend you enable Night Light on windows

#

Your eyes will thank you

mortal hare
eternal night
#

but that doesn't burn like I want it to

mortal hare
#

it really looks good

#

at least for me

#

i dont like reds and orange colors

#

unless they're pastel

lunar schooner
#

For eclipse I use Darkest Dark, for Intellij i use whatever the default is

#

I use eclipse for Java, intellij for rust and then vscode for TS/SCSS/Html, so this is a project requiring 3 open editors, fun :"D

mortal hare
#

why don't you use intellij for java

ivory sleet
#

Ever tried super bright white theme?

lunar schooner
#

I tried intellij for java for a while, I didnt really like it

glass sparrow
#

one dark on top

lunar schooner
#

For rust too, Im not entirely happy

ivory sleet
#

pro python coder

glass sparrow
#

mans got python exams

eternal night
#

intellij rust isn't there yet 😭

ivory sleet
#

true

mortal hare
#

i love sublime text more than vs code

#

but

#

its git support

ivory sleet
#

intellij for haskell when?