#help-development

1 messages · Page 1960 of 1

solid lion
#

so i would "get" the item and then check the radius of said item for entities then do damage to them?

summer scroll
#

Yes

solid lion
#

okay ill try that out thank you

stray crescent
#
discord:
  - tellraw @a {"text":"https://discord.gg/spigotmc","underlined":true,"color":"blue",clickEvent:{action:open_url,value:"https://discord.gg/spigotmc"}}
#

YML parser has no problem with this, how do I go about this?

#

Here's the error I get ^

#

wait

#

look at that screenshot instead

#

"invalid chtat component"

#

use json reader

#

look at the last link I sent

neon minnow
#

Im a bit confused, I used thread.sleep and it crashed my server, do i use async on that part where it is doing thread.sleep then? Im making a cooldown bar like this

::::::::::::::::::::::::::::::::::::.......

But when its executed because of thread.sleep it crashes server, so do i just put this into async? Will the bar still work after that ? Do i use bukkit scheduler or

sullen marlin
#

Do i use bukkit scheduler or

#

yes

stray crescent
#

ok got it to work

#

how do I give permission to an alias?

sullen marlin
#

the permission will be the same as the main command

neon minnow
#

hi md5 🙂

stray crescent
#

nooo won't work

#

must be discord.* then

#

cause i tried "discord"

#

maybe i do "discord.*"

sullen marlin
#

no

#

it would literally be minecraft.command.tellraw

#

aliases dont have permissions

#

they just execute the command

stray crescent
#

but i have it in a /discord command?

sullen marlin
#

commands.yml really isnt good, but the essentials echo command is sometimes used

#

its an alias

#

all an alias does is execute the commands you listed

#

if you want something more advanced you need a plugin

#

there's like 10000 custom command plugins

#

top result on google

stray crescent
#

so i cant just have a default minecraft perm that allows de-opped to do all alias commands?

sullen marlin
#

ALIASES ARE NOT COMMANDS

stray crescent
#

Feels really trashy to add a whole plugin for 1 command

sullen marlin
#

well use a plugin that allows you to add 1000 commands 😉

stray crescent
#

I know but the fact that I can do /discord as an OP but not as a deop tells me that there's a built in permission

sullen marlin
#

the permission is the tellraw permission

#

because aliases just execute the commands you listed

stray crescent
#

so if they have that permission they cal also do /tellraw in chat right?

#

can*

sullen marlin
#

yes

stray crescent
#

alr just send me the commands plugin instead pretty please

sullen marlin
river oracle
stray crescent
#

Dr. Michiaki Takahashi!

#

Ofcourse

#

exactly who I was looking for

sullen dome
#

people will be happy they were able to help blob

stray crescent
#

Plugin to have a broadcast every 10 min?

summer scroll
#

bump

stray crescent
#

Plugin to have a broadcast every 10 min?

sterile token
#

Hey

sterile token
sterile token
stray crescent
#

nono just if there's a plugin for it

stray crescent
#

cant chat in there

sterile token
worldly ingot
#

are you writing in python? lol

neon minnow
#

fixed

neon minnow
mortal hare
#

I was thinking

#

is returning new completablefuture object as a callback to the bukkit runnable

#

bad if im using bukkit runnables, or is it ok

#

i don't have thread pool, and i don't want to execute my code in fjp so im using bukkit runnables

worldly ingot
#

You can make use of a BukkitRunnable to handle your CompletableFutures, yeah, that's fine

lavish hemlock
#

Out of curiosity: what does the scheduler do that the concurrency API doesn't?

lost matrix
#

You can actually call a method sync on the main thread form within a CF

worldly ingot
#

You could Thread#sleep() to handle your futures if you really wanted to lol

#

Operates based on ticks, Maow

#

Plugin association of tasks as well

lavish hemlock
#

API or implementation difference?

mortal hare
#

im returning CompletableFuture<Boolean> for later handling

mortal hare
lavish hemlock
#

Well, that'd be the reasonable conclusion.

#

But CraftBukkit works in strange ways.

lost matrix
#
  public CompletableFuture<ItemStack> getPlayerItemAsync(JavaPlugin plugin, UUID playerID) {
    return CompletableFuture.supplyAsync(() -> {
      try {
        return Bukkit.getScheduler().callSyncMethod(plugin, () -> this.getPlayerItem(playerID)).get();
      } catch (InterruptedException | ExecutionException e) {
        return null;
      }
    });
  }

  public ItemStack getPlayerItem(UUID playerID) {
    Player player = Bukkit.getPlayer(playerID);
    return player == null ? null : player.getInventory().getItemInMainHand();
  }

Example

mortal hare
#
    private final ThreadPoolExecutor executor = new ThreadPoolExecutor(
            4, Integer.MAX_VALUE,30L, TimeUnit.SECONDS, new SynchronousQueue<>(),
            new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build()); // Paper
#

it uses ThreadPoolExecutor internally

#

it constructs threadpool manually

#

although that's paper

#

i don't know spigot

mortal hare
#

it reduces your parallelism

lost matrix
#

What is FJP?

mortal hare
#

ForkJoinPool

lost matrix
#

Ah i see. Then just supply a single thread executor.

mortal hare
#

i have no idea how to manage an executor in my case

#

i need to shutdown somehow

#

whenever its not used

lost matrix
#

Why? Thats not something you should care about. Let java handle when to put threads to sleep.

mortal hare
#

you need to shutdown your executors

lost matrix
#

You can do that when the server stops. Just create an executor when it starts with the desired amount of threads. Then onDisable flush it in a blocking fashion.

mortal hare
#

and how would i encapsulate the thread executor

lost matrix
#

You dont really need to. Just create an instance and use it where its needed.

mortal hare
#

so you're saying that i should pass it as an argument

lost matrix
#

If you really want to encapsulate it:

public class SingletonThreadPool {

  private static final ExecutorService EXECUTOR = Executors.newSingleThreadExecutor();

  public static <T> T use(Function<ExecutorService, T> function) {
    return function.apply(EXECUTOR);
  }

}

usage

    CompletableFuture<Integer> cf = SingletonThreadPool.use(executor -> CompletableFuture.supplyAsync(() -> 10, executor));
neon minnow
#

How can I turn a string into an enum of sound

#

thanks

#

(playsound)

lost matrix
mortal hare
neon minnow
mortal hare
#

i don't know kotlin

neon minnow
#

lol

lavish hemlock
#

Uhh you should be able to use valueOf

#

Are you trying it on Enum or your actual enum type?

neon minnow
lavish hemlock
#

Because it doesn't exist on Enum

neon minnow
#

im trying it in

#

playsound

#

public static final Sound GLASS
// Enum constant ordinal: 22

lavish hemlock
#

Sooo Sound.valueOf(args[0])?

neon minnow
#

Thanks that worked

#

Sorry im still learning

lavish hemlock
#

I mean it's the same as Java's but yeah

#

I don't know why Kotlin doesn't have Enum.valueOf though

mortal hare
#
Even if you parallelize with multiple threads...IO to a single physical disk is intrinsically a serialized operation. Each thread would have to block, waiting for its chance to get access to the disk. In this case, multiple threads are probably useless...and may even lead to contention problems.
#

answered myself

#

im saving files to hard drive

#

so yeah

neon minnow
#

Do actionbars,tablistheaders,footers and title sending have an api in 1.18

young knoll
#

Yes yes yes and yes

quaint mantle
#

1.8 cringe

sullen marlin
#

Lol

lavish hemlock
#

Meh

#

I stopped caring about the 1.8 debate

#

Same shit, different day as my dad would say

maiden thicket
#

md5 :yooo:

sullen marlin
#

hi

mortal hare
#

is this ok

#

static getter for singlethreaded executor

drowsy helm
#

whats the usecase

mortal hare
#

for async IO operations

#

without depending on the tickrate and the plugin's instance

elfin atlas
#

He question is there a way to check from a list of locations what is the nearest from the player location and teleport them then there

eternal night
#

I mean, just a plain for loop would do

mortal hare
#

vector distance, but i bet there's a method for that

eternal night
#

use distanceSquared for this ^

elfin atlas
eternal night
#
final List<Location> locations = ...;
final Location playerLocation = ...;
Collections.min(locations, Comparator.comparing(l -> l.distanceSquared(playerLocation)));
neon minnow
#

I was thinking about this but what is a very simple method to do inventory pages? What would be the code behind it logically? Im not asking for spoonfeeding code, im just really wondering like -- what would it look like? if anyone can briefly write some pseudocode

lost matrix
neon minnow
#

i unblocked you because you are being nice now

lavish hemlock
#

Really just depends on your abstractions

lost matrix
#

You can also have a LinkedList approach where each GUIInventory holds a reference to the next and to the previous one

neon minnow
#

Oh

#

Well i was thinking of something like getting the array of the data and just making the inventory every time the user flips the page and saves the number of the page so then it can remove X amount from array something like that

lavish hemlock
#

Hard to maintain, not a great idea.

neon minnow
#

and just calculating things if more pages are needed etc

lost matrix
rough drift
#

So one of my plugin's files is taking up alot, alot of storage (for ex someone sent a ss of 789MB of data), and the format is like so

uuid
value
uuid
value

any better alternative? (this has to be loaded so i can check specific values for specific players, meaning 789MB won't cut it)

lavish hemlock
#

What file format are you using?

#

Like

#

JSON, YAML, etc.?

neon minnow
#

dont you have a db

lavish hemlock
#

No that's your structure

rough drift
#

its

uuid
value

neon minnow
#

what file

#

u storing in

#

and where you storing

#

why cant u use db

rough drift
#

oh, no ext

lavish hemlock
#

Oh so it's just line-by-line then?

rough drift
lost matrix
lavish hemlock
#

Use DataOutputStream/DataInputStream or SQL

rough drift
#

with a single value

lavish hemlock
#

Storing it as binary would reduce that size by a lot

lost matrix
lavish hemlock
#

Probably via Map

rough drift
lavish hemlock
#

Map uses a Set for keys

#

Meaning there can be no duplicates

lost matrix
lavish hemlock
#

I meant keySet

rough drift
# neon minnow why cant u use db

i mean if there was a builtin db i'd use it (one that people don't have to setup, most people using my plugin struggle editing the config lol)

lost matrix
lavish hemlock
#

Well a lot of people already have DBs

rough drift
#

it handles who is in the game and who is off the game

lost matrix
#

But 800mb can easily be couple hundred mb in memory...

rough drift
#

however it also stores some extra data

rough drift
#

i know

lavish hemlock
rough drift
lost matrix
#

Then you should re-design your data storage

rough drift
#

its not a round game

#

it just affects the world

lavish hemlock
#

Yeah but every time the server shuts down, you essentially invalidate the "is player online" data.

lost matrix
lavish hemlock
#

That is also true ^

rough drift
#

its like

#

if you are off, you can't join the server anymore, thats what i was talking about

#

its like an elimination system

lavish hemlock
#

So, a ban?

#

Oh I see

#

Okay so, then you don't need to store if a player is "on"

rough drift
#

i aint doing that

lost matrix
rough drift
neon minnow
rough drift
#

i hadn't tought of that

#

so you mean like

lavish hemlock
#

I mean all you really need to do is just store a list of UUIDs lol

rough drift
#

uuidofplayer (file)
data (in the file)

rough drift
#

so yeah

lost matrix
# rough drift i also store a tiny amount extra data needed

AsyncPlayerPreLoginEvent is async and you can block the player there while you load his data.
Then one file per player would be better.
Just <UUID>.txt
storing all his content. This way you can load <UUID>.txt when the player joins because you will
have his uuid and therefor his file name.

rough drift
#

good point

#

ill do that

#

thanks :D

lavish hemlock
#

I'd also personally recommend using data output/input streams due to binary being smaller and faster.

lost matrix
lavish hemlock
#

It's not :p

rough drift
#

DataInputStream/DataOutputStreams do that

lavish hemlock
#

As he said it's only "a tiny amount of extra data"

#

And those streams provide a fuck ton of great utils

#

That make it really easy to encode/decode stuff.

lost matrix
lavish hemlock
#

<size of list> <string size> <string contents> <string size> <string contents>

#

Then you just read the list size, and iterate till you reach the end.

lost matrix
#

Yeah. And the you need a bytebuffer and know the size of each character. And the encoding and so on.

lavish hemlock
#

Nope

#

writeUTF/readUTF

#

Just store it as Java's modified UTF-8

#

And the size of a character in that format is always 1 byte iirc

#

(even though a char is 2 bytes? wtf Java?)

#

Legit I can write an implementation rn off the top of my head

#
try (DataInputStream src = ...) {
    final int size = src.readInt();
    final String[] strings = new String[size];
    for (int i = 0; i < size; i++ {
        strings[i] = src.readUTF();
    }
}
#

Done

lost matrix
#

I doubt that this is really beneficial to be honest. Json is way less error prone and the overhead is acceptable because all IO should be done async regardless.
And the user wont notice a difference between waiting 5ms or 30ms in login.

lavish hemlock
#

The speed isn't the concern it's the size

rough drift
#

^

#

i should also use a inflator/deflator stream wrapping the data streams

#

should also provide a tiny boost

lavish hemlock
#

You'd wanna wrap the data streams around the flators

rough drift
#

oh yeah

#

wrong order

lost matrix
#

Sacrificing stability, readability and maintainability for size does not sound like a good idea to me.
I would rather try another approach instead of hammering a 800mb blob into a smaller size.

lavish hemlock
#

It's still stable, readable, and maintainable. What are you on about?

lost matrix
#

Like having a <UUID>.json file for each user and only load data when its needed.

rough drift
#

and really easy to read

lavish hemlock
#

If you need stability between changing the format, JSON isn't going to help you. Add a fucking versioning byte.

#

e.g. 0 = version 1, 1 = version 2 (new and improved!)

#

and so on

#

I'd argue it's readable due to the fact it's more readable than mainly encoding/decoding it I've done this before

#

Instead of using a lot of bit magic, you're just working with method calls

lost matrix
lavish hemlock
#

Theoretically, you don't need to implement custom serializers/deserializers.

#

I wrote a library that can generate them automatically, and its default implementation uses data input/output.

#

Is that stable? Fuck no.

lost matrix
#

Ive come to the conclusion that binary data is not worth it unless minimal size is an absolutely crucial requirement.
Which is rarely the case.

vivid cave
#

https://i.imgur.com/LJJcqqX.png what kind of delay are we talking about?

  • 1 tick because we need to make the PlayerJoinEvent finished triggering
  • an arbitrary value, which may vary based on the server performance
  • an arbitrary value, which may vary based on the player connection
lavish hemlock
#

But it's still an example of how easy it is for someone to do the same thing.

lavish hemlock
#

It's easier to analyze a format you made because you know the patterns.

#

I can't remember an entire class file off the top of my head but I can remember a data file I wrote in binary.

lost matrix
lost matrix
vivid cave
lavish hemlock
#

Either they're a contributor, in which case they can read the code, or they're just a curious server owner, who I'm not trying to appeal to.

#

"But ma bugtesting" - Then they can file an issue report so I can analyze it for them.

#

Also you could easily maintain binary given the proper abstractions.

lost matrix
#

Make one mistake when implementing binary serialization -> might corrupt everything without any chance of recovery.

lavish hemlock
#

I wrote said abstractions in like, less than 3 hours.

lavish hemlock
#

Either through manual testing or unit testing.

lost matrix
#

And recursive serialization.

lavish hemlock
#

No I was referring to the actual serializer/deserializer bit, not scanning and common implementations.

#

But, yes, I have a framework that does that.

#

Even then, I'd argue that automatic serialization like that leaves you with a lot less control.

lost matrix
#

Alright you do you... I clearly have a different opinion on that topic. Wont even get started with data migration. Storing all that in a sql or nosql db would be fun for sure.

lavish hemlock
#

A problem I have with Gson is that you have to implement manual serialization just to have a better API in some cases.

#

You ever read a version manifest? The thing is filled with garbage that is just better to filter out.

#

(But, then you need to implement manual serialization, which is a nightmare with Gson)

#

(I know this because I had to write abstractions just to work with it)

lost matrix
lavish hemlock
#

Nullability.

#

And the amount of chained method calls.

lost matrix
#

Dont just throw keywords at me... Nullability is not a problem exclusive to Gson. And i dont even know what you mean my "chained method calls".

lavish hemlock
#

Meh

rough drift
#

imma still not go with json

#

i deeply not like json when there are better alternatives

lost matrix
#
  @Override
  public JsonElement serialize(PlaceholderExpression src, Type typeOfSrc, JsonSerializationContext context) {
    JsonObject jsonObject = new JsonObject();
    jsonObject.addProperty("original", src.getOriginal());
    jsonObject.add("icon", context.serialize(src.getIcon()));
    return jsonObject;
  }

Thats as complex as it gets with custom serialization when using Gson.

lavish hemlock
#

Hell yeah, resist the public mentality @rough drift. You deserve a cookie 🍪

rough drift
#

xD

#

no but like seriusly

#

i don't wanna go like

opal juniper
#

i love json!

#

it’s so simple

lavish hemlock
rough drift
#
public class MyPlayerDataFile {
  private String abc;

  public String getAbc() {
    return abc;
  }
}

Gson gson = new Gson();
gson.load(string, MyPlayerDataFile.class);
```or smt like that
#

thats just bad design

lost matrix
#
  @Override
  public PlaceholderExpression deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    JsonObject jsonObject = json.getAsJsonObject();
    String original = jsonObject.get("original").getAsString();
    ItemStack icon = context.deserialize(jsonObject.get("icon"), ItemStack.class);
    PlaceholderExpression condition = new PlaceholderExpression(original);
    condition.setIcon(icon);
    return condition;
  }

Simple...

lavish hemlock
#

What if one of those are null?

#

Hell, what if all of them have the potential to be null?

#

We're talking theoretical situations here, not your actual use-case.

rough drift
#

meanwhile, data output streams:

out.writeUTF(abc);

in.readUTF();
lavish hemlock
#

pfff

rough drift
#

much easier to use those ngl

lost matrix
#

Then they are just null... which means the constructor will be called with null values. Which will be a problem with every de-serialisation method.

lavish hemlock
#

Sure but it's still a fuckin' nightmare in Gson

#

Mainly since you work with a lot of optional data at once

lost matrix
#

The code ive sent is null safe. Gson handles all of that.

rough drift
#

imagine the json structure changes, you have to change the class you load to and every class that uses it

lavish hemlock
#

Anyway I don't feel like arguing anymore since it's literally 4 AM for me

#

And it's my fucking birthday

#

Aaaand I'm not in a great mood

rough drift
rough drift
#

gn maow :D

lost matrix
#

I also got mine in a month. I just hope nobody bothers me XD

rough drift
#

(i guess its gn since 4am)

lavish hemlock
#

Probably only sleepin' at like 5-6 AM

rough drift
#

ohk

lavish hemlock
#

Sleep schedules

rough drift
#
private fun getOutputStream(file: String): DataOutputStream {
    return DataOutputStream(DeflaterOutputStream(FileOutputStream(file)))
}

private fun getInputStream(file: String): DataInputStream {
    return DataInputStream(InflaterInputStream(FileInputStream(file)))
}
```tada
neon minnow
#

How do i use bukkit scheduler because i try to use it but my server is still lagging.....

#

I need to use thread.sleep

lavish hemlock
#

Oh shit you use Kotlin?

#

Dang I like you

#

You are based like me

rough drift
#

yeah kotlin is good

lavish hemlock
#

Kotlin is fantastic

neon minnow
rough drift
#

somethings i prefer java for some stuff (like api's that don't have a kotlin impl)

lavish hemlock
#

I think most of Kotlin's APIs are better but ye

#

You seen Clikt yet? Compare that shit to JCommander lmao

rough drift
#

nope but i gotta check it out

#

HOLY

#

its so good

lavish hemlock
#

It is

#

It really is

#

It covers like all possible use-cases too

neon minnow
#

Yeah i use kotlin too...

lavish hemlock
#

I don't code in Kotlin very often but it does consistently make me happy.

#

I'm just one of those people who is stuck with Java out of the comfort of already knowing it :/

neon minnow
#

How do I use bukkit scheduler (https://ibb.co/44sZWw5) because my server still lags when I do


            override fun run() {

                for (i in 1..100) {
                    myshitFunction()
                    Thread.sleep(cooldownTime.toLong())
                }
                for (i in 4 downTo 1) {
                    myshitFunction()
                    Thread.sleep(230)
                }
            }

        }.runTask(Instance.plugin)
rough drift
rough drift
neon minnow
#

i dont understand...

chrome beacon
#

Never use Thread.sleep when working with Spigot

rough drift
lavish hemlock
#

Never use Thread.sleep in general, it's usually not a good idea :p

chrome beacon
#

A runnable won't magically fix the fact that you're pausing the server thread

rough drift
#

tho generally its so slim, don't use it

neon minnow
rough drift
#

why not learn the bukkit api first-

lavish hemlock
#

?learnbukkit

#

lol

rough drift
#

?learnbukkitbeforemakingpluginsplease

#

aw i tought it was a command

lavish hemlock
rough drift
#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

lavish hemlock
#

Ditched their ass

#

Now I'm the one who talks behind their back >:)

chrome beacon
rough drift
#

i put it when i think my point has been conveyed so i just don't write anymore xD

lavish hemlock
#

I put it as an actual cut-off

#

like when I stop a sentence in the middle of ty-

#

-ping it

chrome beacon
undone axleBOT
rough drift
lavish hemlock
#

nah I meant for like

#

✨ dramatic effect

rough drift
#

o

lavish hemlock
#

e.g. when my boyfriend says some stupid shit and I have to take a moment to process and make fun of him

rough drift
#

lmao

lost matrix
lavish hemlock
#

That is confusing.

neon minnow
rough drift
#

(in the msg)

lost matrix
#

3.21 -> 2.79
If you format that using %.1f then it will be 2.7

rough drift
#

fair

lost matrix
undone axleBOT
lost matrix
#

?scheduling

waxen barn
#

Is there some easy way to store just 1 int between restarts or do I have to create a binary file for it?

lost matrix
#

If you really dont want to write into a file

lavish hemlock
#

The world has a PDC?

#

Does my computer also have a PDC?

#

Am...

#

Am I a PDC?

waxen barn
lost matrix
#
Bukkit.getWorlds().get(0).getPersistentDataContainer().set(NamespacedKey.fromString("custom:version"), PersistentDataType.INTEGER, 90);
waxen barn
lost matrix
#

Hm... quite recent. A workaround would be to use the PDC of a fixed chunk.
So the PDC of the chunk 0/0 at the main world. But lets see when the world got a PDC.

#

?stash

undone axleBOT
eternal night
#

world PDC is available on 1.18.1 only

#

the API was first added 3 days ago 😅

waxen barn
#

hmm, I'll probably need to use something different then xd

#

because I want to support more versions than just 1.18.1

lost matrix
#

So the PDC of the chunk 0/0 at the main world.
Just hack it in there

#

But dumping data into a binary file is really not that much effort.

eternal night
#

chunk pdcs exist since 1.16 iirc

lost matrix
#

Perfect. You wouldnt want to support anything earlier.

waxen barn
eternal night
#

Yea, just make sure to not grab 0/0 but preferably the servers spawn chunks (which might be moved)

#

chunk PDC has the unfortunate issue that chunks unload and load

#

so if someone moves the world spawn but you grab the PDC of the chunk at 0/0 a bunch -> loading that chunk over and over

lost matrix
# waxen barn hmm, that's probably ok
@Data
public class SomeConstants {

  @Getter
  private static final transient SomeConstants instance = loadOrCreate();
  private static final transient Gson GSON = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();

  private static SomeConstants loadOrCreate() {
    JavaPlugin plugin = JavaPlugin.getPlugin(SmileCore.class);
    File folder = plugin.getDataFolder();
    File file = new File(folder, "constants.json");
    if (!file.exists()) {
      return new SomeConstants();
    }
    try {
      return GSON.fromJson(Files.readString(file.toPath()), SomeConstants.class);
    } catch (IOException e) {
      e.printStackTrace();
      return new SomeConstants();
    }
  }

  private SomeConstants() {}

  private int version;
  private String info;
  private double temp;

  public void save() throws IOException {
    JavaPlugin plugin = JavaPlugin.getPlugin(SmileCore.class);
    File folder = plugin.getDataFolder();
    folder.mkdirs();
    Files.writeString(new File(folder, "constants.json").toPath(), GSON.toJson(this));
  }
  
}
    String info = SomeConstants.getInstance().getInfo();
    SomeConstants.getInstance().setInfo("New Info");
  @Override
  public void onDisable() {
    try {
      SomeConstants.getInstance().save();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

Thats all a bit hacky but at least you can add as much data into the constants class and it will always be up to date without changing anything.

waxen barn
lost matrix
lavish hemlock
#

Lmao 7smile7 is just getting his ass beat by the bytes

lost matrix
#

The user does not notice a difference between 2ms and 20ms. Its literally 1/50th of a second.

waxen barn
lost matrix
#

And here you can literally just add a Map<String, Integer> or even some deeply nested shit with complex classes and you dont have to change a single line of code besides adding all the data you want.

lost matrix
#

I mean. If its literally just a single int and you are 100% certain that you wont ever have to add any other data then go ahead and write your 4 bytes into a file.

#

hell you can even just use the name of an empty file

lavish hemlock
#

Ooh reminds me of the folders programming lang

#

Fun fact: A newer spec of it is name-agnostic.

lost matrix
#

I really need to update my vocabulary. I use "stuff" too often

lost matrix
lavish hemlock
#

Stuff some stuff into your vocabulary

#

Btw AHEM

lost matrix
#

Esoteric languages are funny. Do you know MOO

lost matrix
lavish hemlock
#

Yeah

#

See who made it

#

:3

lost matrix
#

yif

lavish hemlock
#

Ah yes that's my favorite instruction

#

Oh ye and you can write like

#

some programs in it

#

there's no way to do file IO or UI so it's basically as useless as brainfuck

#

but

#

y'know :)

lost matrix
#

brainfuck can use IO
stdout

lavish hemlock
#

Not file IO

lost matrix
#

Sure. You can use stdout to do file IO

wispy plume
#

Hey, how can I disable switching spectator targets?
I want to allow a spectator to get into an entity, but I don't want them to switch entities without dismounting from the first one and then mounting to another.
Is there an event called when doing that, or do I have to play with packets?

lavish hemlock
#

No I'm pretty sure Brainfuck doesn't support piping or redirection or whatever the fuck

lost matrix
#

It has access to stdout. It can do anything. You could even do http requests if you wanted.

sullen marlin
#

Pretty sure theres an event

lavish hemlock
#

Can I run Brainfuck in Brainfuck?

sullen marlin
#

Might be the teleport event with teleport reason

waxen barn
lost matrix
wispy plume
#

Yep, PlayerTeleportEvent.TeleportCause.SPECTATE
Thank you!

lavish hemlock
#

Can I run Minecraft in Brainfuck?

drowsy helm
lost matrix
lavish hemlock
ebon topaz
#

how do i make a command only i can use?

chrome beacon
#

Why do you need that

lost matrix
sullen marlin
#

Definitely permission...

chrome beacon
#

^^

warm light
#

Which is best? Oracle JDK or OpenJDK or other?

neon minnow
#

OpenJDk

lost matrix
#

I mean. If he wants it to be absolute then permissions wont cut it as everyone else with this permission or op could execute that command

lost matrix
warm light
#

No diff? like performance or etc?

lost matrix
#

Its the same jvm. No difference at all performance wise.

lost matrix
#

*After youve optimized minecraft/bukkit/spigot for your needs

#

Isnt there like

#

?performance

#

?optimize

#

?optimise

#

hm

#

?optimization

#

🤔

#

?makespigotnotlag

#

?lag

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
**__Admin:__**

selfrole Add or remove a selfrole from yourself.

**__Cleanup:__**

cleanup Base command for deleting messages.

**__Core:__**

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

**__Downloader:__**

findcog Find which cog a command comes from.

**__Mod:__**

names Show previous names and nicknames of a member.
userinfo Show information about a member.

**__ModLog:__**

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

**__Permissions:__**

permissions Command permission management tools.

lost matrix
#

very helpful...

#

?cc list

opal juniper
#

?flags

undone axleBOT
lost matrix
#

I see

ebon topaz
#

is there a way to make a custom food eatable while max hungry

eager hazel
#

Hello. I need help with Chunk Format. On the page there is a https://wiki.vg/index.php?title=Chunk_Format to outdated examples, and for the required version 1.18 only to Node.js. Has anyone come across Chunk Format and can help with Java code example?

chrome beacon
ebon topaz
#

but then i would get the effect from a golden apple wouldnt i?

chrome beacon
#

That's handled server side

#

You can stop that

tardy delta
#

Node.js?

eager hazel
eager hazel
desert tinsel
#

How to save a custom .yml file after editing them?

chrome beacon
tardy delta
#

What al i even looking at?

chrome beacon
tardy delta
#

My brain goed brr rn

#

Thought we we're talking about chunks and now we got nodejs

eager hazel
tardy delta
chrome beacon
#

Sorry for the ping...

eager hazel
#

😆

chrome beacon
#

That implementation is 1.18

#

If you cannot get it working head over to their discord

eager hazel
#

I'm going to implement something similar in Java

desert tinsel
chrome beacon
eager hazel
#

I can not find an example of decrypting files of regions

gritty urchin
#

Hey, does anyone know how to code custom entity pathfinding

#

I assume this requires some sort of work with packets

#

or NMS

lost matrix
#

nms. Packets dont make the entities behave differently.

gritty urchin
#

Ok

#

also what is the spigot server maven repo

#

for nms

lost matrix
#

What version are you on?

gritty urchin
#

1.8.8

#

dont shoot me

lost matrix
# gritty urchin for nms

sigh
You need to run BuildTools once for 1.8.8 to install it into your local maven repo.
Then the dependency is the same with the exception of the artifactID which is now spigot instead of spigot-api

chrome beacon
#

?bt

undone axleBOT
gritty urchin
#

yeah ok

#

i think ill just add it to dependencies manually

lost matrix
gritty urchin
#

why not

#

its just provided

#

i dont need to compile with the project?

lost matrix
#

Ok but how do you compile your jars? Do you build artifacts?

gritty urchin
#

no

#

build with maven

lost matrix
#

Ok and what do you mean by "manually adding" the dependency. Using mvn install:install-file?

gritty urchin
#

just adding to modules and dependencies

#

and setting to provided

lost matrix
#

I mean. Just run BuildTools once and add

    <dependency>
         <groupId>org.spigotmc</groupId>
         <artifactId>spigot</artifactId>
         <version>1.8.8-R0.1-SNAPSHOT</version>
         <scope>provided</scope>
    </dependency>
gritty urchin
#

ye

#

or download the paper jar 😄

lost matrix
#

paperclip works a bit differently...

#

Anyways do as you like.

gritty urchin
worn tundra
#

uuugh

#

1.8.8

tender shard
worn tundra
#

definitely not

tender shard
#

yes it isn't

#

fun fact

#

the latest version is always the best

worn tundra
tender shard
#

oh is that site up again?

worn tundra
#

1.8.8 can almost go to school

tender shard
#

it was gone for some months

tender shard
worn tundra
#

💀

tender shard
#

yeah everyone aged 7 or older is legally allowed to buy alcohol

spare prism
#

https://paste.md-5.net/osebudivak.cs

14:29:46 [INFO] returned: []

14:29:46 [INFO] punishments: []

14:29:46 [INFO] punishmmentType: Ban

14:29:46 [INFO] 1111

14:29:46 [INFO] 2222

14:29:46 [INFO] list before: []

14:29:46 [INFO] list after: [md.mirrerror.cloudbans.units.punishments.BanPunishment@9def369]

Why returned is always empty? Is it because I fill it async and return it sync? If so, how can I avoid it?

tender shard
#

no, sync/async doesn't change anything

#

what should it return?

spare prism
#

but it returns an empty arraylist

spare prism
#

but I have to do it async

#

cause it is a db connection

#

how can I fix it?

lost matrix
grim ice
#

that's fucked up imo

lost matrix
grim ice
#

15 or 16 still fucked up

#

15 was possibly an emo kid a year ago

lost matrix
lost matrix
#

Show me some code

spare prism
# lost matrix Show me some code
List<String> result = new ArrayList<>();
ProxyServer.getInstance().getScheduler().runAsync(Main.getInstance(), () -> {
    // db connection etc...
    result.add(resultSet.getString("test"));
});
return result;
lost matrix
#

The problem here is that the list will be empty when you return it because the database call takes a while.

spare prism
#

but how can I avoid it

#

I mean

#

to do it async

#

but to return a correct object

lost matrix
# spare prism but to return a correct object

Solution: Dont return a List but return a CompletableFuture of that list.

  public CompletableFuture<List<String>> fetchData() {
    return CompletableFuture.supplyAsync(() -> this.loadData());
  }

  private List<String> loadData() {
    List<String> result = new ArrayList<>();
    // db connection etc...
    result.add(resultSet.getString("test"));
    return result;
  }
#

A completable future doesnt have that object right away. But it tells you that it will have that object eventually.
So you dont use the object directly but rather define actions for that object as soon as the CompletableFuture has it.

#
  public void tellPlayerAllBans(Player player) {
    CompletableFuture<List<String>> listFuture = this.fetchAllBannedPlayers();
    listFuture.thenAccept(list -> {
      for (String name : list) {
        player.sendMessage(name);
      }
    });
  }

  public CompletableFuture<List<String>> fetchAllBannedPlayers() {
    return CompletableFuture.supplyAsync(() -> this.loadAllBannedPlayers());
  }

  private List<String> loadAllBannedPlayers() {
    List<String> result = new ArrayList<>();
    // db connection etc...
    result.add(resultSet.getString("test"));
    return result;
  }
#

Compact version:

  public void tellPlayerAllBans(Player player) {
    this.fetchAllBannedPlayers().thenAccept(list -> list.forEach(player::sendMessage));
  }

  public CompletableFuture<List<String>> fetchAllBannedPlayers() {
    return CompletableFuture.supplyAsync(this::loadAllBannedPlayers);
  }

  private List<String> loadAllBannedPlayers() {
    List<String> result = new ArrayList<>();
    // db connection etc...
    result.add(resultSet.getString("test"));
    return result;
  }
#

CompletableFutures are really hard to understand initially. And you need to fully grasp the concept of lambdas because you will see them used a lot
in CF contexts.

spare prism
#

tysm, @lost matrix

#

I will try it

spare prism
#

it doesn't work either, @lost matrix

#
    public CompletableFuture<List<Punishment>> fetchPunishments(String key) {
        return CompletableFuture.supplyAsync(() -> this.retrievePunishments(key));
    }
if(dataManager instanceof MySQLManager) ((MySQLManager) dataManager).fetchPunishments(key).thenAccept(list -> this.punishments = list);
blazing scarab
#

Don't think about the result, think about what are you going to do with it

spare prism
# blazing scarab Don't think about the result, think about what are you going to do with it

I'm going to initialize all my fields in the class 🙂

    @Override
    public void retrieveData() {
        DataManager dataManager = Main.getDataManager();

        String key = Utils.getKey(name);

        if(dataManager instanceof ConfigManager) if(!dataManager.isRegistered(key)) dataManager.registerPlayer(key);

        if(dataManager instanceof MySQLManager) ((MySQLManager) dataManager).fetchPunishments(key).thenAccept(list -> this.punishments = list);
        else this.punishments = dataManager.retrievePunishments(key);
        System.out.println("retrieved: " + punishments);
    }
blazing scarab
#

you have design problems

spare prism
gritty urchin
quaint mantle
#

so i am trying to use this to deserialize an itemstack array in the same file as the menu class, how would i do so?

gritty urchin
#

Hey

#

how would I make a custom nms zombie

#

immune to sunlight

young knoll
#

Does it need to be NMS

gritty urchin
#

yes

#

I want custom entity pathfinding

#

and to override other default behaviour

young knoll
#

There’s probably a method that controls it

#

Or you can use the combust event

gritty urchin
#

I've found it

#

#n();

#

so what do i do now

young knoll
#

Well, what does the original n() do

gritty urchin
#

well its where the sunlight burning part is stored

young knoll
#

Override it

gritty urchin
#

yeah but then I have to rewrite every single method inside it

#

or most of them

#

cuz they are protected

young knoll
#

Not much you can do there

gritty urchin
bright wind
#

how to write it?

gritty urchin
#

[wb, craftingi]

bright wind
#

thx

young knoll
quaint mantle
#

how would i make an ArrayList<ItemStack> just an ItemStack?

young knoll
#

Get an element from it

#

A list is generally multiple of an object

quaint mantle
#

how to use no-clip in 1.17?

worldly ingot
#

go into spectator mode?

quaint mantle
#

falling blocks^

worldly ingot
#

I'm not sure I understand. There are no blocks that clip through terrain as far as I'm aware

quaint mantle
#

there was a way to set no-clip to true before they updated Nms

grim ice
#

what is JUnit

#

like how does it work and what is an example case of when to use it

#

that isnt a coding question

devout sinew
#

my fauly

#

fault

gritty urchin
#

Hey

#

how do I make a custom nms zombie

#

move to a specific location

grim ice
#

what class was it

#

EntityZombie right

#

or what class

gritty urchin
#

yeah EntityZombie

#

ive spawned the zombie

#

and overridden some default goals

grim ice
#

.getBukkitEntity() on the EntityZombie

#

does that exist

gritty urchin
#

yes

grim ice
#

ok

#

now u can .teleport()

#

on getBukkitEntity()

gritty urchin
#

yeah but I want it to walk

#

like move to another location

#

and turn its head also

#

in the direction it is facing

grim ice
#

then use pathfinder goals

#

I've found this but it's for 1.13.2

#

public void moveToLoc(Entity en, Location loc){
EntityCreature cr=((EntityCreature) ((CraftEntity) en).getHandle());
cr.getNavigation().a(loc.getX(), loc.getY(), loc.getZ(), 1);
}

#

or maybe its possible to make an invisible entity then make it the target of the mob

#

not sure if that is worth trying

gritty urchin
quaint mantle
#

i have three arraylists, how would i merge them into one arraylist or something of the same purpose

#

public transient ArrayList<ItemStack> menuitems = new ArrayList<>();
public transient ArrayList<Integer> menupositions = new ArrayList<>();
public transient ArrayList<String> menunames = new ArrayList<>();

gritty urchin
#

I think its pathfinder goals have to defined

#

in its constructor

#

but idk how to do that

grim ice
#

found this in google tho

#

not sure if u wanna follow his advice

gritty urchin
#

ye but I dont think 1.8 does

#

1.13+

#

annoying

grim ice
#

I assume you wanna make a Menu class

hasty prawn
#

I've had issues with goals and paper before, although I was using NMS

quaint mantle
#

i need to merge these three arrays somehow

#

since they output to json

hasty prawn
#

On Spigot my mob did everything right. On Paper he kinda just stood there with a blank stare 🧍‍♂️

grim ice
#

make your own class

quaint mantle
#
    @EventHandler
    public void onLeftCLick(PlayerInteractEvent e) {
            if (e.getAction() == Action.LEFT_CLICK_AIR){
                if (e.getPlayer().getInventory().getItemInMainHand().getItemMeta().getDisplayName().equalsIgnoreCase("§6Gyrokinetic Wand")){
                    new GyrokineticStorm(e.getPlayer()).play();```
How do i addnull check in this?
grim ice
#

basically make a class Menu

#

.getName(), .getPosition(), .getItem()

#

then an arraylist of that class

#

honestly idek what u wanna do

grim ice
#

anyways you shouldnt check items by names

quaint mantle
#

this is just to mess around with friends soo no need to make it too fancy

#

but i need to make a null check if held item aint null bcz if its null it spams console

hasty prawn
#

What's null

grim ice
#

then do it

hasty prawn
#

probably getItemInMainHand or getItemMeta

grim ice
#

if(item != null)

#

literally

#

llol

grim ice
#

in his code

hasty prawn
#

Or do it the other way ;)

if(item == null) return;

grim ice
#

thats what i usually do ^

hasty prawn
quaint mantle
hasty prawn
#

If you just check a random thing that can't be null that's not very helpful

grim ice
#

he knows how to get the ite

#

ite

#

m

#

he did it in his code so

hasty prawn
#

Nevermind lol

grim ice
#

weird question tbh

#

eitherway

quaint mantle
#

i can use if(item == null) return; this right

grim ice
#

yes

midnight shore
#

Hi guys! I have a problem
Basically i want to have a variable named Health which can go up to Integer.MAX_VALUE and i want it to be my max health. But there is a catch: I don't want to have 500+ hearts. I want it to cap at 20 hearts maximum. How can i do this?

quaint mantle
#

its a very neat way ty

grim ice
#

or you could store the health somewhere else

tardy delta
#

is streaming and filtering Bukkit.getOnlinePlayers less efficient than looping over them and checking with an if?

midnight shore
grim ice
midnight shore
#

i think yes

quaint mantle
#

but since gson can't understand itemstacks, i have to deserialize menuitems seperately

#

so

grim ice
quaint mantle
#

i cant make a class

midnight shore
#

wait, now there is another problem. my hp in general caps at 520 even if i have more than that

midnight shore
#

the actual health

#

that message says that i've been healed

grim ice
#

I am not spanish or whatever that language is

#

either way

#

just make your own health system

midnight shore
#

that is my own health system

grim ice
#

although it will interfere with other plugins but whatever

midnight shore
#

and thats not spanish

grim ice
#

nah add an attribute to the Player

#

or

#

save each player health in a hashmap

midnight shore
#

never mind

#

i found the problem

grim ice
#

o alr

gritty urchin
#

@grim ice do u know any pathfinding libraries

#

for 1.8.8

grim ice
#

No

#

sadly

midnight shore
#

basically i wasn't setting the max health so it stayed to the one i had before testing this

midnight shore
#

never mind

quaint mantle
#

null check is only working with items not with empty hand should i add a air check too?

midnight shore
#

The game crashed whilst unexpected error
Error: java.lang.NullPointerException: Cannot read field "A" because "☃" is null
Codice di uscita: -1

what the hell is this

gritty urchin
#

CustomZombie.java

#
CustomZombie.EntityTypes.spawnEntity(zombie, new Location(p.getLocation().getWorld(), p.getLocation().getX() + 2, p.getLocation().getY(), p.getLocation().getZ()));```
#

where it is spawned

mellow mesa
#

Hey, I am currently having a problem many people in forums had, but I couldn't find any helpful answer. It's about world generation and how to just modify the existing world generator and not setting up a new one. In my case, I want to replace every generating block in a chunk so that every chunk consists of a random block. All the forum answers were rather confusing for me, so it would be great if someone can help me, maybe in DMs or so.

hasty prawn
gritty urchin
#

no kb

#

but it takes damage

#

so you can kill it

#

been stuck on this for like 4 hours

hasty prawn
#

Hmm weird, I have no idea. If you were using 1.18 I could help you more but... 😟

gritty urchin
#

is there a lot of API change

#

between the two?

hasty prawn
#

Well for one, 1.18 has mojmaps so it's not obfuscated.

gritty urchin
#

ah

#

is there anyone here

#

who is good at 1.8.8 NMS?

#

or do you know anybody?

hasty prawn
#

Probably no one in here, afaik all the active helpers in here don't support 1.8.

#

Most the people asking questions are on 1.8

#

Or, most people who support 1.8 are asking questions, not answering them.

#

Generally if you're going to support 1.8 you're kinda on your own.

young knoll
#

I remember 1.8 NMS

#

Just like it was yesterday 7 years ago

gritty urchin
#

yeah I know it is outdated

#

I just want to know how to spawn a custom nms zombie

hasty prawn
#

Your best bet is to find also outdated forum threads then

gritty urchin
#

that doesn't stand still

gritty urchin
hasty prawn
#

Yikes, well I'm not sure what's wrong with what you're doing tbh.

obtuse torrent
#

can i ask spigot questions here?

vocal cloud
#

I don't know can you?

obtuse torrent
#

i dont know thats why i ask

young knoll
#

Read the channel description

obtuse torrent
#

ok thanks

#

am trying to code in 1.8.8 i downloaded buildtools and ran it with git bash, i restarted intellij but i still cant change the version in pom

vocal cloud
#

?paste the not working pom you're trying to use

undone axleBOT
maiden thicket
#

1.8 nms scares me

obtuse torrent
#

like the code?

maiden thicket
#

no reason to

#

if someone uses it its "fOr pVp"

#

1.8 nms also is stinky

obtuse torrent
#

ok

maiden thicket
#

did u specify the version

#

when u ran buildtools

obtuse torrent
#

yeah

maiden thicket
#

are u using mave or gradle

obtuse torrent
#

maven

maiden thicket
#

show me ur dependency

obtuse torrent
#

why?

maiden thicket
#

to see if u wrote it correctly

vocal cloud
#

I love the why?

obtuse torrent
#

i used the minecraft developer plugin

#

in intellij

maiden thicket
#

that doesnt use nms

#

that uses spigot api

#

only

vocal cloud
#

We don't care what you used that's not what we're asking

#

show us the pom

obtuse torrent
vocal cloud
#

Then you save it and send the url

obtuse torrent
#

its rn 1.12 but trying to change it to 1.8.8

maiden thicket
#

yes so replace spigot-api w just spigot

#

and replace the version w 1.8.8-R0.1-SNAPSHOT

obtuse torrent
#

ok

#

oh that works

#

thanks

#

but its wierd in tutorials its spigot-api and it works but yeah

maiden thicket
#

spigot-api includes org.spigotmc and org.bukkit

#

spigot includes those w nms and craftbukkit

obtuse torrent
#

oh

vocal cloud
#

I mean 1.8.8-R0.1-SNAPSHOT works just fine for me shrug1

#

for spigot-api

obtuse torrent
#

do you use Minecraft developer plugin?

vocal cloud
#

Yes

obtuse torrent
#

wierd

vocal cloud
maiden thicket
#

yeah i know he wanted nms tho

vocal cloud
#

1.8.8 NMS 🤢

maiden thicket
#

1.8.8 🤢

lavish hemlock
#

1.8 🤢

maiden thicket
#

old legacy versions 🤢

obtuse torrent
#

java makes me rage quit

lavish hemlock
obtuse torrent
lavish hemlock
#

Fair enough

maiden thicket
#

L

vocal cloud
#

Oracle SQL makes me rage

ivory sleet
quaint mantle
quaint mantle
#

same

young knoll
#

The heck is haxe

quaint mantle
spare patio
vocal cloud
#

No mercy

stiff quest
#

looking to hire a java programmer to rewrite an old plugin for 1.16.5
its a fairly complex world gen plugin called
Cityworld.

stiff quest
#

ty

tardy delta
#

no ai is nice kekw

austere cipher
#

Question, would it be possible to use packets to create "sharding", where players build in the same location, though blocks appear visible only to them (client-sided) as packets are sent to them only? Minimalizing server resource usage

tardy delta
vivid cave
#

is there a way to cache packets in a player? i mean
i cache the packets inside their files/memory, and then instead of keep resending the same packets in cycle, i just tell them to use packet n°3 then n°4 then n°5 then back to n°1 in a loop
its for animated stuff, no i won't be using texture packs/data packs, right now the packets are cached on the server and i keep sending them to the player in a loop, instead i thought it would be better if i send them only once and tell them "switch to this packet for this, or to that packet"

tardy delta
#

poor zombie

gritty urchin
#

is anyone here familiar with 1.8.8 NMS?

delicate lynx
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

grim ice
#

Should I learn more java that I get to a fairly advanced level or do I learn another language

#

the only other language I might learn is Rust

#

other than Rust maybe C#

waxen plinth
#

Depends on your goals

waxen plinth
#

Rust is a very cool language and definitely worth learning if you ask me

grim ice
#

that might be too general

waxen plinth
#

Try a new language but I think it's good to have at least one language you could consider yourself an expert in

#

For interviews you will usually be able to pick a language to work in

grim ice
#

how much time of experience is an expert

waxen plinth
#

Having a language you know like the back of your own hand is extremely valuable for interviews

#

I've been doing Java for about 8 years and I feel very confident in my skills

grim ice
#

damn 8 years

waxen plinth
#

Where the actual line of "expert" is is hard to say

waxen plinth
#

But I could write code to do most things without the help of an IDE, without looking up how to do any of it

#

I don't have any other language I'm that good with

#

So I always interview in java

#

And it's been really useful

vivid cave
#

caching packets into player memory?

waxen plinth
#

My friend knows a lot of languages, definitely a lot more than me, but he's not really an expert of any of them so he struggles a bit more in interviews

#

It's not even so much about skill as it is just familiarity

lavish hemlock
#

I guess I know his answer to "Would you rather be an expert in one language or know a bunch of languages"

waxen plinth
#

Knowing the standard library off the top of your head makes a huge difference

waxen plinth
waxen plinth
#

I can use a lot of languages but I'm far better with Java than any other

grim ice
#

ic

lavish hemlock
#

I am a Java expert, with a good amount of Kotlin knowledge, and I know a lot of langs but am not a big fan of/am not good at them.

grim ice
#

ok then ill focus on java

#

tbh i find java perfect eitherway

#

it might not be as fast but its fine

waxen plinth
#

I really like Java too

#

It's plenty fast for almost everything

lavish hemlock
#

I don't, I'm just good at it.

grim ice
#

i find java organized

waxen plinth
#

It's pretty simple, fast, has good naming conventions, streams are really nice

grim ice
#

but it's not really good to make good looking applications with though

waxen plinth
#

Rust is probably the most immaculately designed language I have ever seen but it's hard to write

lavish hemlock
#

I find the problems with Java stem from verbosity

grim ice
#

How do people make really cool looking apps btw

waxen plinth
#

I think even an expert in rust could have difficulty writing code that will compile and work the first try

grim ice
#

is there some markup language for apps or smth

waxen plinth
waxen plinth
grim ice
#

otherwise how do people make cool looking apps

#

okay makes sense

#

is javafx

#

the only good way

#

to make java apps

lavish hemlock
#

Also yeah basically "good looking" Java apps come down to:

  • Requiring an extensive knowledge of Swing
  • Using JavaFX
waxen plinth
#

I never really had a problem with those

#

You can usually keep hierarchies relatively simple

lavish hemlock
#

I mean

#

Not when you have 2 modules

#

One API and one impl

#

And they sorta

#

mirror each other

#

Which is a very common pattern from what I've seen :p

#

It's unmaintainable.

grim ice
#

Alright so uh

#

what do you guys think I should learn now

waxen plinth
#

I always encourage people to write a JSON parser

grim ice
#

is there a reason why json is better than YML

waxen plinth
#

It's a good intermediate project that teaches you about a lot of good concepts

lavish hemlock
#

And I mean that's not the only problem I have with Java.
You have this situation where you need a factory class because using constructors doesn't give you enough power.

#

But y'know a factory per class is obnoxious, so static factory methods, although not everyone agrees on using them.

waxen plinth
#

Yml is much more annoying to parse

lavish hemlock
#

(Also sometimes your factories need to store a bit of state)

grim ice
#

how is it that ba

#

bad

lavish hemlock
#

(And people will scream static abuse)

grim ice
#

sounds easier than parsing json

lavish hemlock
#

Uhh YML is hard to parse because YML is an obnoxiously complicated format

grim ice
#

or maybe not

lavish hemlock
grim ice
#

i find json way too unreadable tbh

#

just looks ugly

lavish hemlock
#

Well it's not designed to be readable

#

It's designed for networking

waxen plinth
#

I can express json's entire format in just 11 lines of bnf

lavish hemlock
#

Yeah lol ^

waxen plinth
#

You literally cannot represent yaml with bnf

grim ice
#

what even is bnf

waxen plinth
#

A format for describing file formats

lavish hemlock
#

Backus-Naur Form: It's a grammar that allows you to describe formats/languages.

grim ice
#

what

waxen plinth
#

It's a bit like regex but much more powerful

lavish hemlock
#

Is YAML context-sensitive?

waxen plinth
#

Yes

#

Because indentation is syntactic

lavish hemlock
#

Oh dear

waxen plinth
#

Yeah lol

#

That's why you can't bnf it

lavish hemlock
#

So yeah BNF is described as a "metasyntax"

#

Meaning it's syntax for describing syntaxes

grim ice
#

i dont get it kekw

waxen plinth
#

Meanwhile here's json

lavish hemlock
#

It's typically used by people designing lexers/parsers

waxen plinth
lavish hemlock
#

Or also by parser generators like ANTLR

waxen plinth
#

It's 13 lines but you can easily get it to 11

lavish hemlock
#

Also JSON is just faster to parse

#

Also to write

waxen plinth
#

Yeah just look at simdjson

#

JSON is honestly great

grim ice
#

oh so do parsers use bnf

waxen plinth
#

It's really simple and gets the job done