#development

1 messages ยท Page 146 of 1

tacit quail
#

if i want to use kotlin std-lib whats the import?

icy shadow
#

val size: Int this quite literally implies it cannot change

tacit quail
#

cause I want to use isLetter

dusty frost
icy shadow
dusty frost
tacit quail
icy shadow
#

you should have the stdlib already then

icy shadow
#

if you have access to Char and Int and such you do

dusty frost
#

^

dusty frost
#

I would not be surprised if you were trying to do it on a String or something

tacit quail
#

i found it i needed to do import java.lang.Character.

dusty frost
#

uh

tacit quail
icy shadow
dusty frost
#

Kotlin has its own platform-independent Text stuff under kotlin.text.

dusty frost
tacit quail
#

it works

dusty frost
#

you shouldn't even need to import anythign?!

icy shadow
#

kotlin bad yes

dusky harness
tacit quail
brittle thunder
dusty frost
#

it is literally just part of the prelude lmao

tacit quail
#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
โ€ข HelpChat Paste - How To Use

brittle thunder
#

@dusky harness scram

dusky harness
tacit quail
icy shadow
brittle thunder
#

:)

dusty frost
#

isLetter is a method on Chars

dusky harness
#

Char#isLetter

dusty frost
#

you do index.isLetter()

tacit quail
dusty frost
#

you're using a raw function call

icy shadow
#

he thought school was only for 1 day! he mad ๐Ÿคฃ ๐Ÿ˜ญ

dusty frost
#

it's not a raw function

#

it's a method on Chars

dusty frost
#

so you do Char.isLetter()

dusky harness
#

also why is the text variable outside of the function

#

๐Ÿค”

dusty frost
#

global constants? lmao

tacit quail
dusky harness
dusty frost
dusky harness
#

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

brittle thunder
#

State bad

icy shadow
dusty frost
brittle thunder
#

We need more useless pure programs

tacit quail
dusty frost
#

ONLY?

#

you've never touched any other language

#

this is like day 1 OOP lang stuff

tacit quail
#

not in a year

icy shadow
tacit quail
brittle thunder
#

๐Ÿ˜จ

dusty frost
#

possibly also one called women

tacit quail
#

C when you declare the variable locally

brittle thunder
#

Oh thats covered fingerguns

dusty frost
#

oh?

dusky harness
#

wdym

brittle thunder
#

๐Ÿ˜ท

dusty frost
#

Yugi gets bitches?

tacit quail
#

no

dusty frost
#

damn

brittle thunder
#

I got haskell

#

Thank you!

#

Simon is enough for me

#

๐Ÿ˜Œ

dusky harness
#

its still pinned

#

๐Ÿ’€

dusty frost
#

I have a feeling encripion's countLetters function is going to be easily replaced with a stream lmao

brittle thunder
dusky harness
brittle thunder
dusty frost
dusky harness
#

word.count(Char::isLetter)

#

ez

dusty frost
#

you know what i'm talking about

icy shadow
broken elbow
brittle thunder
#

Or

dusky harness
dusky harness
broken elbow
dusky harness
#

also all this time I've read your name as "encryption"

#

just found out its encripion

dusty frost
#

damn I didn't know Kotlin has cute method references with ::

pulsar night
#

Is there a reason that chunks are 16x16 or is it just random numbers

dusty frost
brittle thunder
# tacit quail elaborate?

involving many carefully arranged parts or details; detailed and complicated in design and planning.

dusty frost
tacit quail
dusky harness
#

alr then

#

๐Ÿ‘

tacit quail
#

its just taken on all websites

#

so i sue thsi

brittle thunder
#

๐Ÿฅธ

pulsar night
dusty frost
# tacit quail elaborate?

if countLetters() just gives the number of letters in a given string, you can replace that with a single method call in the standard library lmao

tacit quail
dusky harness
#

Yes

#

also extension functions > top level functions

dusty frost
dusky harness
brittle thunder
dusty frost
#

having lots of small ones is preferable to having a ton of big ones

brittle thunder
#

Thats what they have in Area 51

#

A lot of useful extensions

dusky harness
#

just ask

#

and you shall receive

#

๐Ÿ˜Œ

dusty frost
brittle thunder
#

that they want to hide from us

dusty frost
#

cause Kotlin is very high level and has a very nice standard library lol

tacit quail
#

im never going back to C

dusky harness
#

๐Ÿฅฒ

tacit quail
#

it feels like assembly compared to this

dusty frost
#

I mean it pretty much is

merry knoll
#

even though i love kotlin

dusty frost
#

C is painful lol

dusky harness
merry knoll
#

some library stuff they have is just pain

tacit quail
#

this is a whole new world

dusky harness
#

you can use shadow's minimize if you want to reduce jar size too

pulsar night
brittle thunder
#

Also, swift is pretty great, feels a lot like kotlin with some extra features

tacit quail
#

i cant describe this feeling

dusty frost
hushed badge
dusty frost
brittle thunder
#

and @dusty frost , I did end up with the exact issue I mentioned about kotlin in swift

dusky harness
dusty frost
#

AND YOU DON'T KNOW WHAT A METHOD IS?!

dusky harness
#

๐Ÿ’€

tacit quail
tacit quail
#

i dont remember much except i like it

pulsar night
dusky harness
#

kotlin is a little similar to swift I've heard

brittle thunder
dusty frost
brittle thunder
#

XCode seems to be pretty shit at traversing code

dusty frost
#

oh yeah

#

use AppCode

brittle thunder
#

Sometimes you can check callers and it wont really show you

dusky harness
#

ios development requires a mac โ˜น๏ธ

brittle thunder
dusty frost
#

Swift in general pretty much requires a mac lol

dusty frost
#

Fleet moment coming soon

pulsar night
brittle thunder
#

Hopefully yeaa

#

But fleet isnt free either I think?

dusty frost
merry knoll
#

with rust?

dusky harness
dusty frost
dusky harness
#

might be free in the student thing

tacit quail
#

@dusky harness the .count(is letter) works but is there something for words and sentances im assuming not that seems very unecesary

brittle thunder
dusty frost
dusky harness
merry knoll
#

wouldnt say its harder honestly for rust

dusky harness
#

right

#

forgot

dusty frost
tacit quail
#

and to count certain punctuation

brittle thunder
dusky harness
#

or

tacit quail
dusty frost
brittle thunder
#

Yea

dusky harness
#

count { it.isLetter || it.isWhitespace }

#

etc

tacit quail
#

C programming has killed me

pulsar night
tacit quail
dusky harness
#

wdym

dusty frost
dusky harness
#
val isValid = char.count { it.isLetter || it.isWhitespace || somethingElse }```
tacit quail
dusty frost
tacit quail
#

oh i guess i do make a variable

dusky harness
#

it doesn't matter

#

variables just hold data

dusty frost
#

and I myself have literally turned to Go to make a compiled quick program lol

#

it is much easier to not worry about borrow checking

brittle thunder
#

Mhm

dusky harness
#

question
languages like C, Go, Rust, etc - since they compile natively, do you have to be on that OS to compile for that language?

icy shadow
#

oh gee, people talking about rust. it would be a shame if i said something wacky like "rust bad"!

high edge
#

Go good

icy shadow
#

no

tacit quail
#

var total_words = text.count {it.isWhitespace() } is this the right use?

icy shadow
#

you can usually cross compile

#

or at least you can with go

dusty frost
#

LLVM and GCC do it

brittle thunder
#

All languages except Assembly bad

#

Too slow

icy shadow
#

ummm

brittle thunder
#

Inefficient

dusky harness
dusty frost
#

but holy shit it's pretty hard to use

brittle thunder
#

Have you tried switching from C to Circuit Boards

tacit quail
brittle thunder
#

Great transition

merry knoll
dusty frost
#

at least to my experience, I am a lot more used to thinking in easily mutable languages with a garbage collector lmao

dusky harness
#

right?

#

one for mac, linux, and windows

dusty frost
#

there are many more architectures

#

and you generally choose your target

merry knoll
tacit quail
#

@dusky harness so is there a way i can do this for punctuation but exclude certain types of punctuation or do i do it the old fashion way with if statements?

dusty frost
#

you can write your own little filter method and use that

#

or check if each char is in a certain Set

#

there are a lot of high level ways lol

tacit quail
dusty frost
#

you could just make your own filter function

#

that takes a char and returns true/false based on if it's good

dusky harness
tacit quail
dusty frost
#

see bam that was one of the things I said too

tacit quail
dusty frost
dusty frost
#

that's more clear and easier

merry knoll
#

oh god inline

tacit quail
dusky harness
#

I can't spell

#

typo

dusty frost
#

yeah he spelled it wrong lmao

tacit quail
#

o i got it

#

lmao

errant kraken
dusky harness
#

I think

#

unless im mixing up 1.17 and 1.18

#

I'm mixing those up

#

right

#

A

broken elbow
#

you are

dusky harness
#

okay

dusty frost
#

1.18 is the terrain

dusty frost
#

gotta go ask them

errant kraken
#

I am the dev

dusky harness
#

๐Ÿ’€

errant kraken
#

idk what's the issue

dusty frost
#

oh lol

#

at io.github.idoomful.bukkitutils.statics.MaterialUtils.getBlocksInChunk(MaterialUtils.java:79) ~[KrownedStacker-1.0.0 (2).jar:?] what's that

errant kraken
#

Block block = chunk.getBlock(x, y, z);

#

apparently it can't get blocks at Y -1

broken elbow
#

ugh

#

you're getting blocks from a chunk

#

not from a world

#

d;spigot Chunk#getBLock

dusty frost
#

yeah but chunks should be 384 blocks tall

uneven lanternBOT
#
@NotNull
Block getBlock(int x, int y, int z)```
Description:

Gets a block from this chunk

Returns:

the Block

Parameters:

x - 0-15
y - world minHeight (inclusive)
z - 0-15

dusty frost
#

his thing says 0-256

#

but chunks are 384 tall

broken elbow
#

oh

#

I see

dusty frost
#

cause it goes -64-320

broken elbow
#

yeah yeah I know

dusty frost
#

kinda weird

broken elbow
#

I Didn't realise what version they were on

dusty frost
#

i guess you could go look at the code for org.bukkit.craftbukkit.v1_18_R2.CraftChunk.validateChunkCoordinates lol

broken elbow
#

was literally on my way looking for that

dusty frost
#

damn Blitz you dedicated

#

good work, keep it up

broken elbow
#

xD

dusky harness
broken elbow
#

it has its min and max provided thru parameters.

broken elbow
#

maybe there's some conflict with that?

dusky harness
#

which then goes to LevelHeightAccessor#getMinBuildHeight and LevelHeightAccessor#getMaxBuildHeight

broken elbow
dusky harness
#

paperweight

dusky harness
broken elbow
#

oh. I went to the spigot hub

errant kraken
#

I can't find the source code

broken elbow
dusky harness
#

seems to trace back to DimensionType

#
    protected static final DimensionType DEFAULT_OVERWORLD = create(OptionalLong.empty(), true, false, false, true, 1.0D, false, false, true, false, true, -64, 384, 384, BlockTags.INFINIBURN_OVERWORLD, OVERWORLD_EFFECTS, 0.0F);

the -64 is minimumY

#

so

#

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

broken elbow
#

wait. did height change in the nether?

dusky harness
#

nope

broken elbow
#

and end?

dusky harness
#
 protected static final DimensionType DEFAULT_NETHER = create(OptionalLong.of(18000L), false, true, true, false, 8.0D, false, true, false, true, false, 0, 256, 128, BlockTags.INFINIBURN_NETHER, NETHER_EFFECTS, 0.1F);
    protected static final DimensionType DEFAULT_END = create(OptionalLong.of(6000L), false, false, false, false, 1.0D, true, false, false, false, true, 0, 256, 256, BlockTags.INFINIBURN_END, END_EFFECTS, 0.0F);
#

nope

broken elbow
#

@errant kraken is the world you got the chunk in maybe an end world or a nether world?

dusky harness
#

ooh maybe

#

๐Ÿ‘€

errant kraken
#

idk what world this error came from, I'll have to ask

#

apparently the nether doesn't go below Y 0

dusty frost
#

yeah it doesn't

broken elbow
#

there we go

lyric gyro
#

your mum

broken elbow
#

was walking down the street

lyric gyro
#

fuck you automod

stuck hearth
#

Fuck up

errant kraken
#

How do I pass an ItemStack to HoverEvent so I can show it in chat?

#

I've tried this but it shows air ```
final JSONObject itemJSON = new JSONObject(dyn.getOnHover().getItem().serialize());
final BaseComponent[] componentItem = new BaseComponent[] { new TextComponent(itemJSON.toJSONString())};

hover = new HoverEvent(HoverEvent.Action.SHOW_ITEM, componentItem);```

round smelt
#

Hello everyone !
I have a little problem with Guilds plugin ...

Here is my error:

java.lang.NullPointerException: Cannot invoke "me.glaremasters.guilds.api.GuildsAPI.getGuild(org.bukkit.OfflinePlayer)" because the return value of "me.glaremasters.guilds.Guilds.getApi()" is null

How can this be null ? ๐Ÿค”

#

Some clarifications: I getthe API after the server has loaded, being careful that everything is loaded

hushed badge
#

are u shading the api by any chance

round smelt
#

ah f. yes i am

#

thank you ^^"

worn jasper
#

Uhm sooo, an issue I am having rn, is I have this method to store data:

public void storeCache() {
  var startTime = System.currentTimeMillis();
  var players = Bukkit.getOnlinePlayers();
  var stats = cache.getStatistics();
  for (var p : players) {
    var user = cache.getUsers().get(p);
    if (user != null) json.getFileData().insert("data." + p.getUniqueId(), SerialManager.toString(user));
  }
  json.getFileData().insert("stats.generators-placed", stats.getPlacedGenerators());
  json.set("stats.lockers-placed", stats.getPlacedLockers());
  var endTime = System.currentTimeMillis();
  var difference = (endTime - startTime);
  getLogger().info("Successfully synced cache with the database. It took a total of " + difference + "ms (" + (difference / 1000) + "s)");
  getLogger().info("Users: " + json.singleLayerKeySet("data").size() + " | File size: " + json.getFile().length() + " bytes | Online Players: " + Bukkit.getOnlinePlayers().size());
}

And the thing is, it basically deletes all the data, and only sets the data for the players online. Like, should it behave like this? Cause rn, it's deleting data of offline users.... shouldn't it just set the data it needs, without touching the other keys? For context, I am using a library called SimplixStorage.

hushed badge
#

๐Ÿ‘

round smelt
# hushed badge ๐Ÿ‘

Can I ask you to help me remove this shading please ?
I don't know why he's shading everythink even tho I don't want to

hushed badge
#

what build tool are u using

round smelt
#

Maven

hushed badge
#

add <scope>provided</scope> to the dependency i believe

round smelt
#

So that's what this means xDD

#

Thank you so much ^^'

wary dust
#

Has anyone used partitions with lettuce

#

if so could you please explain how it works and how to use it cus the docs and examples are so confusing

tacit quail
#

I want to round the result of the equation in the last line to an Int how could i go about doing that?

#

got it i used .roundToInt()

leaden sinew
#

(I know some of it is a mess, if you want to point out what I could improve I would appreciate that too)

#

Also please ping me if you respond

keen quarry
#

Is there a more simple way of getting a players "session online" time? Instead of saving the time a player logged on and then taking that time agains the current time?

torpid raft
#

dont think so

keen quarry
#

Alright

torpid raft
#

not hard to just maintain a map of players with their login times though

keen quarry
#

And do i need to save that to a file or can i like save it temporarly?

spark orbit
#

nvm got it

torpid raft
#

you can definitely save it temporarily, if you just need the current session time i see no reason to store login timestamps in a file

keen quarry
#

Yeah... but how?

torpid raft
#

you can use a Map<UUID, Long>

#

type of map probably doesnt matter much but if you're accessing it async make sure it's thread safe

keen quarry
#

Alright, will look into it! Thanks!

worn jasper
topaz gust
sharp hemlock
worn jasper
#

And I dont want to messup anything since this is being used in an server with 80+ players

graceful hedge
broken elbow
#

can someone link me the gist that had methods to serialize itemstacks to base64 please?

dense drift
broken elbow
#

thank you โค๏ธ

dense drift
#

made a faq ?base64-serialization

broken elbow
#

btw Gson is available in spigot 1.17-1.19 correct?

#

idk where I can check this

#

other than importing every spigot version and checking

hushed badge
#

yes it is

#

gson has been in since 1.8

broken elbow
#

cool cool. just making sure. I heard some lib was removed in newer versions but I don't remember what. I assumed it wasn't gson since it showed up with the 1.19 api

hushed badge
#

I believe they're removing apache commons

icy shadow
#

good I hate apache

dense drift
errant kraken
#

does anyone have some good Java tutorials for beginners?

neat pierBOT
#
FAQ Answer:

Online Courses:
Online courses are also great for learning java. Some websites that offer them are:

  • Coursera - Free unless you want a certificate
  • PluralSight - Great courses from what I've seen. Mostly Paid
  • Udemy - Never used them myself but they seem to all or at least most be paid.
    My first ever course was one from Coursera. - I can say it was pretty good at introducing me to the programming world as a whole not just java.

Oracle Docs:
Oracle docs can help a lot at learning and understanding java:

  • Start with this,
  • Breeze through this (skipping stuff that doesn't seem relevant like bitwise operators),
  • Hit this.
    They're the first three from this larger thing which you should definitely go through overall. But those three should be enough for slightly better understanding of what is happening here without feeling like a huge time sink.
    That one is a small part of this larger site wherein "Essential Java Classes" and "Collections" also have good useful stuff

Other services:
Some other cool services that will help you learn java are:

As you can see there are plenty of good ways to learn as long as you're willing to invest the time. Have fun learning!

high edge
#

Close enough

solemn ocean
#

I remember having this issue, I have a different damage system so actually I deal damage with player.damage when I need to kill a player and on the damage event i check if its a precise number I kill the player without canceling the damage otherwise the health is removed but not from the actual healthbar infact i cancel the damage event, the issue is that if I put the entityDamager in the player.damage(60,entityDamager) the damage is somehow 31.0

dense galleon
#

Weird question but

#

How do I open a jar file so that.. the program inside it launches?

#

It opens as a zip file by default

#

I am looking through program files/java/jdk-17.0.3.1/bin but I can't find any exe that works

dusty frost
#

you'd need java.exe or javaw.exe, and you'd need to do like java -jar this_is_jar.jar to run it

dense galleon
#

On my old computer I could just do "open with... java something"

#

Why do I have to do all that now

dusty frost
#

Windows bad, I suppose?

dense galleon
#

Ffs

viral moth
#

you have to do it with command prompt, maybe the old button was a shortcut?

dense galleon
#

In my entire life I opened jar files on every single computers just by double clicking on it

#

What the hell ๐Ÿ˜ข

#

Just confused honestly

viral moth
#

sadge

winged pebble
#

You just have to make it an executable jar instead of just a jar

lyric gyro
#

jpackage relieved

wintry grove
#

thats another reason for me to not to update to windows 11

#

good

broken elbow
#

I mean there's no good reason to update at all xD

#

also have you guys heard the leaks? apparently windows 12 will be a thing

stuck hearth
#

Windows11 has worked fine for me

lyric gyro
#

It hasn't worked at all for me

#

Because I never installed it cct

broken elbow
#

โค๏ธ

smoky hound
#

Is there any way to make minimessage work with legacy codes? I'm trying to add support for minimessage without breaking everything so people have time to adjust

steep dragon
#

no

#

your best bet is some sort of string substitution (i.e. replacing all &a with <red> or something), but it won't be a 100% match because of the leaky nature of the legacy format

smoky hound
#

alr thats what I was gonna end up doing :/

#

thansk

stuck canopy
#

        Statement statement = getConnection().createStatement();

        String sql = "CREATE TABLE IF NOT EXISTS minions(location varchar(36) primary key, level int, generated int, skin int, fuel int, shipping int, upgrade int, upgrade2 int, chest int, currentResources int)";

        statement.execute(sql);

        statement.close();

    }```
#

what am I doing wrong here

cinder forum
warm steppe
dense drift
smoky hound
#

yea lol

dense drift
#

What I did for my plugin was to give them a tool to update the config

#

People gotta move forward

#

A good example that I like to use is something like this &6&LE&C&LW&D&LA&B&LR&A&LD&E&LS. -
<b><gold>E<red>W<light_purple>A<aqua>R<green>D<yellow>S</b> I think we can both agree that the first one is totally impossible to read

smoky hound
#

Yea, I'm thinking more for players who aren't gonna be immediately used to minimessage, so I want to provide a way to have a transition period where both &6 and <gold> work

torpid raft
#

<nerd>

dense drift
#

You can do that somehow.. deserialize using legacy serializer, serialize with mini and then deserialize again with mini, but ๐Ÿ˜ฌ

steep dragon
#

you can migrate people's config for them by using legacy deserializer chained into a minimessage serializer (remember it works both ways), which is what paper did recently

steep dragon
dense drift
#

Hmm, fair

smoky hound
#

Yea I tested that and had issues, but its working enough for now to just replace &1 with <dark_blue> lol

rigid mountain
#

Hey guys, quick question.

So i have made a custom player class: https://paste.helpch.at/mijumohevo.java
and then a team class: https://paste.helpch.at/orubofumey.cs

My issue is im saving with Mongo, and im getting circular refrencing on the SPlayer instance inside of the team class. I assume this is because i have an instance of the team class inside of the sPlayer class, but i need to be able to get the player's team from the instance. How can i do that?

lyric gyro
#

it's onEnable, not OnEnable, lowercase o

cinder forum
#

ignnore this warning

#

send startup log

#

?startuplog

neat pierBOT
#
FAQ Answer:

Startup Log Location
Your latest startup log can be found in the logs folder of your
server directory, labeled as latest.log.
Please copy the contents and paste them to a paste service.
Type ?paste for more information.

#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
โ€ข HelpChat Paste - How To Use

mental cypress
#

Why do you need an instance of the team from their class? Can't you just have a method in the team to get the player?

mental cypress
#

I'd prefer not. If you have a question just ask it here. That way if there's a solution found, others will be able to reference it if they have a similar issue!

random kestrel
#

Not like โ€œHow toโ€ฆโ€

mental cypress
#

You can shoot a message to Barry or wait on someone else who might have an answer. I gotta get back to work.

rigid mountain
#

I guess i could just do a string name

rigid mountain
#

bot

random kestrel
#

lol why

#

Do you have email? @mental cypress

rigid mountain
#

error?

lyric gyro
#

You can send a message to Barry and it will be received by the admins, @hurtlay

random kestrel
#

Well ok

cinder forum
#

send plugin yml

#

in the log

#

you sent

#

there is nothing trying to enable plugin Test2 thonking

#

can you send the file

#

you are putting in plugins folder

#

aight

#

weird, what if you restart and not reload?

#

oh wait nvm

dusky harness
#

Ur main in plugin.yml doesn't match

#

Up here it's Test

#

But here it's Test2

dusky harness
#

Send the main class

#

? Paste

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
โ€ข HelpChat Paste - How To Use

dusky harness
#

Oh u changed it

#

Wait what's the issue?

#

Since in the log above

#

It enqvles

#

Enables

#

Oh I see

#

Hmm

#

Try getLogger().info("test")

#

The maybe broadcast doesn't work until the server is enabled

#

I'll get on my pcin half an hour and see exactly what it does

#

Hmm

#

In chat?or u mean console

#

How did you get on the server before the server started

#

In onEnable no players will be on the server so the logger will work

#

And is better since it prefixes it with [Test2] :))

#

Maybe spigot changed it

#

Ig

#

Logger > print/broadcast only to console

#

Usually

#

Unless for some case u don't want the preifx

#

Reload :/

lyric gyro
#

cause that's not a thing?

#

ah that's what you're doing

#

thought you were typing in broadcastmsg lmao

tacit quail
#

there is something like this im pretty sure

#

not sure if you have to use the loop

#

are you able to do * users

#

when specifying the users

#

player.*

#

not sure the syntax

#

but when specifying certain player

#

are you able to do that?

plush stirrup
#

Could someone help me through looping through this?

data:
  fbfbfe36-a993-410f-abc9-85ea7fcf55b4: '&#000000test'```
tacit quail
plush stirrup
#

Basically, I want to loop through my yaml file to get the player name from the output of the players command /realname (nick)

tacit quail
#

so just use a loop until you find the matching UUID?

plush stirrup
#

Well, the realname command is to find the player from the nick

#

i need to loop through each value to find the right one, but i want to get the key to then translate it into a player name

tacit quail
#
if variableForPlayerCommandInput == current row in the config
return the value that the UUID has as a string
``` thats how i would do it
#

idk syntax ๐Ÿ˜‚

tacit quail
viral moth
#

what i would do is have 2 maps
first map: String -> List<UUID> | nickname to list of player UUIDs (since there could be 2 people with the same nick name)
second map: UUID -> String | player UUID to real name

yes you could skip the 2 map process and just have a String -> List<String> map but i'd typically use it in more than one place and having both maps might be useful. as for loading the yml to the maps, just loop through the keys and get the corresponding value and load it

#

you could also call Bukkit.getPlayer(uuid).getName() instead of the second map, ill leave it up to you tho

stuck hearth
#

I would just not allow players to share the same nickname.

#

Seems like a lot of hassle

viral moth
#

yeah but the whole idea of a nickname is to be someone else essentially lol

viral moth
plush stirrup
#

Thx guys!

high edge
#

You shouldn't allow same nicks, kinda makes it easy to impersonate people

random kestrel
#

At least this will protect the server owners a little from exploit

random kestrel
#

^ @grim oasis, what is needed for acceptance?

high edge
#

Why would that even be needed since it's permission based?

random kestrel
high edge
#

Huh?

high edge
#

Yea but how would you "exploit" it, if the command is permission based, if the people you've given permission for the command exploit stuff, then you kind of deserve it..

random kestrel
sterile hinge
#

that's not an exploit then

grim oasis
#

honestly just get rid of op

#

people are gonna hack the ops are exploit your server

stuck canopy
#

help

#

        Statement statement = getConnection().createStatement();

        String sql = "CREATE TABLE IF NOT EXISTS minions(location varchar(36) primary key, level int, generated int, skin int, fuel int, shipping int, upgrade int, upgrade2 int, chest int, currentResources int)";

        statement.execute(sql);

        statement.close();

    }```
worn jasper
#

uhm, so, currently I am using this to get an armorstand by it's id and delete it.

ArmorStand as = (ArmorStand) Bukkit.getEntity(uuid);
if (as != null) as.remove();

The question is, does Bukkit.getEntity() only check loaded chunks? If so, that would explain the issues I am having.

broken elbow
#

I thought the docs mentioned it but yeah I'm fairly certain it only gets loaded entities aka entities from loaded chunks

worn jasper
#

Hmm, okay, so, I would have to load those chunks that I aim for right?

#

or is there another better way of doing it?

sterile hinge
#

I mean otherwise the server would need to load all chunks until it finds an entity with that uuid

worn jasper
#

I mean, if I know the exact location, I could load the chunk, remove it, and unload it right?

broken elbow
#

also if this is a special entity handled by you, you could remove it on chunk unload from the world, store data you need about it and then either spawn it back when chunk is loaded or don't spawn it at all if you want to remove it

sterile hinge
#

(you should use async chunk loading when using paper though)

worn jasper
#

or wait

#

what's the command again

#

lol

broken elbow
#

its d;

worn jasper
#

me not understand how the command works, will just use old google

sterile hinge
#

there are several World#getChunkAtAsync methods

broken elbow
#

d;paper World#getChunkAtAsync

uneven lanternBOT
#
@NotNull
default CompletableFuture<Chunk> getChunkAtAsync(int x, int z)```
Description:

Requests a Chunk to be loaded at the given coordinates This method makes no guarantee on how fast the chunk will load, and will return the chunk to the callback at a later time. You should use this method if you need a chunk but do not need it immediately, and you wish to let the server control the speed of chunk loads, keeping performance in mind. The future will always be executed synchronously on the main Server Thread.

Returns:

Future that will resolve when the chunk is loaded

Parameters:

x - X Coord
z - Z Coord

worn jasper
#

I mean, but that's to get the chunk, not load it right?

broken elbow
#

Requests a Chunk to be loaded at the given coordinates

worn jasper
#

OH

#

makes sense, what about unload?

broken elbow
#

d;paper World#unloadChunk

uneven lanternBOT
#
boolean unloadChunk(@NotNull @NotNull Chunk chunk)```
Description:

Safely unloads and saves the Chunk at the specified coordinates

This method is analogous to unloadChunk(int, int, boolean) where save is true.

Returns:

true if the chunk has unloaded successfully, otherwise false

Parameters:

chunk - the chunk to unload

sterile hinge
#

the server does that by itself

broken elbow
worn jasper
#

wait wut

sterile hinge
#

unless you specifically set a ticket

worn jasper
#

how exactly does the server know "ok, time to unload this"

#

?

#

Also, what happens if I request several times the same chunk to be loaded async? Does it have some type of queue?

sterile hinge
#

the server knows where the players are, and the chunks out of view distance can be unloaded

#

that's all the ticket system stuff

worn jasper
#

so, it loads it for a few seconds?

sterile hinge
sterile hinge
worn jasper
#

Okay, also, so, I can send the request, but how would I wait for it to be completed to execute the rest.

#

Since the rest of the code requires the chunk to be loaded.

sterile hinge
#

there are methods that return a CompletableFuture and there are methods that take a Consumer

worn jasper
#

never actually worked with CompletableFuture

sterile hinge
#

so instead of waiting in terms of blocking, you can just "listen" to the completion of the future or let the server deal with running your consumer

worn jasper
#

oof deprecated

worn jasper
sterile hinge
# worn jasper oof deprecated

does that even compile? I'd assume that you'd need to specify if you want to call the "new" method that takes a consumer or if you want to use the "old" method that takes the pre java 8 World.ChunkLoadCallback

worn jasper
#

ye it does have both options

#

but idk why the IDE just uses the second

sterile hinge
#

you can just extract it to a variable, like
Consumer<Chunk> consumer = chunk -> { /*do cool things here */};

#

passing that variable to the method should work fine then and use the proper method

worn jasper
#

big bruh

#

this ide do be dumb

#

oh ok

#

I am dumb

#

not ide

winged pebble
#

As my professor used to say, "If you're blaming the code/computer, you're making at least 2 mistakes"

edgy lintel
#

your professor is right
we should be programming on paper

merry knoll
#

they used to make us code on notepad on first year (especially on exams etc)

#

i still dont know why

broken elbow
#

the semester that just ended, all the exams I took were on paper...

#

it was a pain

pulsar ferry
#

Coding on paper in the beginning is nice to help you understand what your code does

broken elbow
#

2-3 pages to write a queue class lmao.

broken elbow
merry knoll
#

pseudo code on paper makes sense to understand the logic

broken elbow
#

nah. I had to write entire programs.

#

had to make queue, stack, they also gave us a phrase for example and then we had to write a program using what we learnt during our OOP class. it was something like, someone eats a pealed apple and some superhero flies and something else

#

xD

dusty frost
#

oh man my first programming class was all in Notepad for like HTML/CSS/JS stuff

merry knoll
#

but it was for java for me

broken elbow
dusty frost
#

it's really interesting to see how people learn to code, cause I've been programming for like 10 years now, so like, some people literally just kept using notepad and javac for Java and everything

#

I was like "dude, imagine the time savings you'll have when your IDE can tell you while you're coding what minor syntax errors you have"

merry knoll
#

nothing beats drjava

dusty frost
#

it was insane, they would spend more time tabbing out, javacing, going back to add a semicolon, and then repeating than they were actually coding

broken elbow
#

I've only been coding for 1 year before uni and I'm not that good but still. damn it was a pain

#

I had to take 3 exams at one of my classes... all on paper, all 6+ pages

dusty frost
#

then I introduced all my friend group to IntelliJ/PyCharm and now they're all addicts

merry knoll
#

i personally didnt mind the paper exam thingy

#

as long as they dont grade on exact syntax

pulsar ferry
#

I did Java in fucking Netbeans in school ๐Ÿฅฒ

merry knoll
#

with pseudo code paper is quite fine

dusty frost
#

Paper exams are good for like, asking questions about understanding and stuff

#

but if you want to test coding, just have them code???

broken elbow
merry knoll
#

as in "whats the output" type questions

#

in first year especially

dusty frost
#

every single test in my software engineering class in university was wishy-washy short answer questions, no actual help with, ya know, software engineering, or any practice or anything

merry knoll
#

afterwards, they dont teach much in languages anyway

dusty frost
merry knoll
#

its more design patterns etc

merry knoll
#

as a gotcha

#

or rather a compile error

#

like please

dusty frost
#

I mean they're good for like, maybe first year students?

#

but guess what, in the real world, you can just run your fucking code lmao

#

try-it-and-see is the motto

merry knoll
#

a lot of times you need to learn someone elses code

#

so i think its still somewhat relevant

dusty frost
#

yeah so you can run their code?

#

easy peasy

#

it's okay to pick up like the absolute basics of language syntax and stuff like if statements

merry knoll
#

not always, you can test and such

dusty frost
#

but it very quickly devolves into dumb pedantry like int x = 2; x--; --x; x++; and then it's like "waht is the value of x as each line gets executed or something

dusty frost
#

i can't think of any scenarios

merry knoll
#

but i feel like its easy to say that its useless right now

#

since your brain kinda gets wired to read it after a while

dusty frost
#

if people are writing code like that, they shouldn't be

#

that doesn't teach you anything useful

merry knoll
#

i dont feel like i can comment that it was useless with my current knowledge

edgy lintel
merry knoll
#

but like constantly i see no point

edgy lintel
#

Donโ€™t worry these ridiculous demands exist everywhere I was asked to code on a paper

merry knoll
#

just so they know how to use the console without an ide

dusty frost
merry knoll
#

if that makes sense

#

i see it as pointless now, but thats with hindsight

dusty frost
#

regardless, that isn't code you encounter

merry knoll
#

ofc not

dusty frost
#

i would be down with like real useful coding encounters

merry knoll
#

you encounter shit like that

dusty frost
#

but this dumb contrived shit is awful

merry knoll
#

once in couple of years tops

#

and you solve it with a google and you are done

dusty frost
#

and i'd rather people be learning how to read real code lmao

merry knoll
#

this

dusty frost
#

maybe it's cause i was self taught like way before my university programming classes but that shit was awful man

merry knoll
#

another thing i realized since i semi worked

#

while i was studying back then

#

that the graduates kinda sucked

dusty frost
#

oh yeah

merry knoll
#

like failing to use basic oop

#

or threading level

dusty frost
#

way too many people just like, do their basic university classes and nothing more

merry knoll
#

although they had like 3.0 + gpa usually

#

so not too bad either in that aspect

dusty frost
#

they don't know git, they don't know how to work with actual code, etc.

torpid raft
#

gateway university coding classes are trash ngl

dusty frost
#

there's no substitute for real world experience when it comes to programming, and computer science is mostly about theory (as the name alludes to)

merry knoll
#

cant talk for computer science

#

but mine was 40% hardware 50% theory

merry knoll
#

rest practical stuff

dusty frost
#

what was your major?

#

ah

merry knoll
#

its a seperate title here

#

compared to cs

dusty frost
#

yeah it is here too

#

computer engineering sounds like mostly hardware lol

merry knoll
#

nah

pulsar ferry
#

I learned so much more when I started working, even more than when I was doing it mostly as a hobby

dusty frost
#

software engineering is the title for pure programming

merry knoll
#

its mostly software still

#

but you also need to take hardware classes

#

similiar to electrical engineering

#

and a lot of programming design

dusty frost
#

you took a similar amount of hardware classes to what electric engineers take?

#

because holy shit we have like 2 hardware classes

merry knoll
#

6 total i think

#

12 classes per year

#

so its quite a lot

dusty frost
#

it's mostly theory, stuff like foundations of computation theory, turing machines, finite automoton, etc.

broken elbow
#

oh. that's a lot of classes.

dusty frost
#

i mean meh not really

#

universities in america do a credit system, most classes are 3 credit-hours, and you usually end up taking 15 credit hours on average

#

but like, i did 6 classes last semester and it wasn't that bad

broken elbow
#

yeah. I used to have 12 classes in 8th grade. but this year, I had 7 classes every semester

broken elbow
merry knoll
#

major classes are 4

#

minor ones are 3 usually

#

and you average 18 - 22 per semester

dusty frost
#

jesus christ

#

that is very bizarre lol, as the acceptable range for "full-time student" is 12-18 credit hours here

merry knoll
#

how many hours is that per week?

dusty frost
#

12-18

merry knoll
#

in class load only

#

thats low

#

its 20 - 25 range usually for us

dusty frost
#

that's time spent in lectures

merry knoll
#

ye

#

exactly

dusty frost
#

not including homework

merry knoll
#

not including homework or lab work

dusty frost
#

you spend 25 hours a week in lectures? what the fuck

broken elbow
#

we have credits here as well but they work completely different. you basically get credits if you pass the class and if you don't, you pay to take the exam again. and every credit costs like 200 RON or something (40-50 USD), and you can take the exam twice a year. And every class gives you a predifined amount of credits if you pass them

broken elbow
merry knoll
#

its.. not that bad honestly

dusty frost
#

we have a MWF/TTH schedule

merry knoll
dusty frost
#

monday wednesday friday / tuesday thursday

#

so classes are on either of those sections of days

merry knoll
#

nah its 5 days for us

#

5 days + saturday for lab sometimes

dusty frost
#

yeah it's 5 days for us too?

merry knoll
#

8:30 to.. 5:30pm basically

dusty frost
#

in university?

merry knoll
#

ya

dusty frost
#

wtf lol

#

if I wanted that I'd go back to high school jesus

merry knoll
#

you get gaps obviously

#

but since its like

dusty frost
#

the point of university is that you get to be free, do whatever you want, plan your schedule how you see fit

merry knoll
#

8:30 - 12:30 then 3:30 - 5:30

#

you end up staying there anyway

dusty frost
#

MWF classes are 50 minutes long, and TTH classes are 90 minutes long

merry knoll
#

its 50 for us

dusty frost
#

or maybe 80

merry knoll
#

4 in the morning and 4 afternoon slots

#

and you plan your schedule yourself

dusty frost
#

slots? ๐Ÿ‘€

merry knoll
#

but since not that many sections open up

#

per class

#

you end up staying with a fucked program

dusty frost
#

our "slots" are just like back to back from like 8am to 6pm

#

but you only end up taking like 2/3 classes per day

merry knoll
#

like 8:30 - 9:20 is one hour slot etc

#

and classes open at certain hour slots

dusty frost
#

it's on the half hour ew

#

ours are like 8:00-8:50

broken elbow
#

waking up at 7:30 to be at uni at 8 for 2 hours then going back home to be back at uni at 14 then going back home and back to uni at 17

#

lmao

merry knoll
#

ye its to match

dusty frost
#

9:00-9:50 etc

merry knoll
#

the legal lunch break here

#

which is 12:30 to 1:30

broken elbow
merry knoll
#

so you get off at 12:20 to 13:30

dusty frost
#

you aren't compelled to be at university here, you just go if you want

merry knoll
#

nah attendance is in the grades usually here

#

you can fuck off if you want

dusty frost
#

what the fuck lol

merry knoll
#

but you lose like 10% of the grade

#

its not exactly in the grade itself

#

but there is like 10% of the grade to be collected

#

in the class

#

through questions etc

#

which happen at random basically so

broken elbow
merry knoll
#

to take the finals

#

"collect 40% of the grade until the final or you fail by default"

#

all this i dont mind much, but some classes are prerequisites to others obviously

broken elbow
#

we don't have grades during the semester. its just the final exam that matters. tho every teacher can chose to change that. a teacher gave us 3 exams and the final grade was the average, another just gave us a bunch of homework and it mattered for 50% of the final grade, etc.

merry knoll
#

and some open at only one semester

dusty frost
#

"collect" is such a weird word to me lol

merry knoll
#

so you fail 3 credits out of 21

#

and you add a year

#

since prerequisites push all classes by 1

dusty frost
#

well yeah some classes are only taught like Spring Semester Even Years

#

so if you're doing a 4 year degree, you have literally two changes to take them

merry knoll
#

yep

#

degrees are 5 years here though

#

1+ 4

#

first one being english only

dusty frost
#

english only wtf lol

merry knoll
#

since the highschool english edication

dusty frost
#

i guess it's a useful skill

merry knoll
#

education* sucks major ass

merry knoll
#

since the classes themselves are in english

#

especially at the better unis

dusty frost
#

ah yeah

#

english is like the language of the world or whatever lol

#

i am quite grateful to be a native speaker

merry knoll
#

its kinda useless for the average joe honestly

#

i use it a lot, but i skipped the year regardless so eh

dusty frost
#

i mean if they want to use any part of the internet not specifically designed for their language, it's pretty good

merry knoll
#

yeah, but its more that

dusty frost
#

especially useful in a programming degree lol

merry knoll
#

if you use a language in your native area only

#

you end up with a really botched version

#

you can semi read but speaking and understanding

#

is out of the question

#

since the person teaching is at B level at max

dusty frost
#

what country is this btw?

merry knoll
#

with close to no actual usage experience

#

its the land of the kebabs

#

turkey <-

dusty frost
#

ah

#

yeah feels like there's not a lot of turkish internet lol

merry knoll
#

there is

#

its just that they avoid the western part like plague

dusty frost
#

i mean like the vast majority of stuff is in english, no?

merry knoll
#

yes and no, turkish communities for basically everything is quite big

dusty frost
#

especially for programming, there aren't like any languages that aren't english-based with keywords and stuff

merry knoll
#

you would be surprised honestly

#

but they all are in this bubble

dusty frost
#

70-80 million says Wikipedia

merry knoll
#

population here is quite young

#

unlike the west

dusty frost
#

๐Ÿคจ

merry knoll
#

so % of people existing in the internet is quite a bit higher

dusty frost
#

i am not sure what kind of point you're trying to make lol

merry knoll
#

trying to say that the communities arent as small as they sound basically

#

obviously way smaller than the english speaking side

#

but proportionally to the population its quite big

#

they exist in completely bubbles though and as circlejerks usually

#

so i tend to use the english side more personally

dusty frost
#

ah nice nice

merry knoll
merry knoll
dusty frost
#

america, sadly lmao

merry knoll
#

i mean, its a nice country

dusty frost
#

though maybe luckily for the lightness of my education?

merry knoll
#

especially if you are in the cs field

#

exactly

dusty frost
#

not really that nice in terms of like basic human rights and stuff

#

but ya know

merry knoll
#

we got a semi dictatorial mustache man at the helm

dusty frost
#

yeah probably a bit weird of a comparison, sorry lol

#

just a few steps backwards from where the us was a bit ago

merry knoll
#

funny enough

#

abortion law especially

dusty frost
#

yup

#

quite bizarre

hoary citrus
#

Do BungeeCord config.ymls work the same way as Spigot? Can I create it, then in the main file say smth like getConfig.options.cooyDefaults?

wanton silo
#

Hello, is there any way to return a placeholder on multiple line?
For example a lore like this:
Hello line 1
this is line 2

high edge
#

loop through the lines and parse it

wanton silo
#

I can't

#

I'm creating a placeholder that is going to be used with deluxemenus for example

high edge
#

DM parses placeholders everywhere so

#

You could either have seperate placeholders like for each line, and it'd split accordingly, or you can try adding \n for it to line break ( not sure if that works )

wanton silo
#

I've just tried using \n and it doesn't work

#

I guess I can't

hoary citrus
#

Whatโ€™s that

#

Itโ€™s my first time using bungee

pulsar ferry
warm steppe
# hoary citrus Whatโ€™s that

Repository: maven("https://repo.triumphteam.dev/snapshots/")
Dependency: implementation("me.mattstudios:triumph-config:1.0.5-SNAPSHOT")

hoary citrus
#

Well Iโ€™m gonna have to wait a week to add it. I donโ€™t actually have WiFi at home so Iโ€™m legit using a computer without internet lmfao

#

But Ty anyway

warm steppe
#
SettingsManager settingsManager = SettingsManager
                .from(new File("plugins/" + plugin.getDescription().getName() + "/config.yml"))
                .configurationData(Config.class)
                .create();
#

it doesn't have any documentation tho

hoary citrus
#

Itโ€™s fine, I might be able to figure it out by myself

#

Will start working on it next week then, thank you

warm steppe
#

Config.class is a class that implements SettingsHolder

#

And this is a basic config entry

@Path("menu.pickaxe-shop.filler")
public static Property<String> PICKAXE_SHOP_FILLER = Property.create("PURPLE_STAINED_GLASS_PANE");
#

and you'll figure out the rest, it's really easy and fast to use

worn jasper
west socket
#

Anyone know how I can import multiple spigot versions with gradle?

#

Gradle by default seems to only import the latest one

icy shadow
#

you will really need multiple modules for that

west socket
#

Hmm

#

So I would have to essentially have two plugins packaged together?

icy shadow
#

not exactly

#

you only change the version specific code

#

but yeah i guess basically

west socket
#

Ohh let me a take a look

#

Thank you

#

What I was trying to do is just have individual classes handling the NMS for different versions that were all called from one central class

icy shadow
#

yeah that's basically exactly what that example does

#

you have an abstract interface that you can use throughout the plugin and then you just get a version specific implementation

west socket
#

Yeah

#

Yeah now that I look at it, thats exactly what I'm doing now but without the seperate gradle files.

#

Ill just go ahead and implement that system

#

Thanks for your help

icy shadow
#

no problem

pulsar ferry
icy shadow
#

dunno what that is

#

i dont believe so

#

what do you need it for?

#

๐Ÿคจ

#

do you mean PersistentDataContainer?

#

that's basically just nbt

#

so either use NBT-API or NMS

#

depending on how much self-loathing you feel

#

the api is definitely easier

#

at a cost of slightly bigger jar size

west socket
#

Hey Brister. How were you able to reference classes that were in seperate modules?

#

I setup the versioned gradle syetem, but I'm not able to access classes across modules

icy shadow
#

you can depend on other modules

#

look at the build.gradle files

#

the only issue is that you can often get circular dependencies which are a pain in the ass

#

but that setup will work for the basics

west socket
#

Oh I didn't see that
๐Ÿคฆ
Thanks again

west socket
#

Oof circular dependency error

native cobalt
#

hello

#

I've got a strange unexpected behaviour in my plugin

#

I'd appreciate any help

#

so, I have this very simple code:

#
public String color(String text) {
        String colored = ChatColor.translateAlternateColorCodes('&', text);
        return colored;
    }
#

with import org.bukkit.ChatColor;

#

but when I use it, it only removes the color codes without applying colors to the text

#

Bukkit.getConsoleSender().sendMessage(chat.color("&fPlugin enabled."));

#

output:

viral moth
#

so

native cobalt
viral moth
#

is that the only way youve tested it?

native cobalt
#

only used it there, yeah

#

the console renders colors from other sources though

viral moth
#

because the "console" will be colored differently than expected

#

try a color other that white maybe

pure crater
#

It depends if your console supports ANSI color coding

native cobalt
#

okey, let me try with other color

#

no, wait

#

actually

native cobalt
#

Bukkit.getConsoleSender().sendMessage(chat.format("&fVersion: &d%version%&f."));

#

using paper 1.18

viral moth
#

what does chat.format do

native cobalt
#

ah, this

pure crater
#

its deprecated for Paper

#

You are supposed to use Adventure components

native cobalt
# viral moth what does chat.format do
public String format(String text) {
        text = text.replaceAll("%plugin_name%", resource.name);
        text = text.replaceAll("%version%", resource.version);
        text = text.replaceAll("%built_prefix%", resource.prefix);

        text = color(text);

        return text;
}
native cobalt
#

where can I find docs on that?

pure crater
native cobalt
#

ah, I see

pure crater
#

(It's automatically shaded into Paper jar)

native cobalt
#

thanks

native cobalt
#

hey

#

sorry, hadn't seen minimessage

#

i'll give it a look

native cobalt
#

hey

#

i gave it a look

#

so, if I wanted to use all the functions from the MiniMessage, the support for color codes (&a and so) would have to be dropped, and in the config files color codes should be specified by its format (<color>)?

lyric gyro
#

Correct

leaden sinew
#

How would I get the world from the CHUNK_DATA packet?

#

Nvm

craggy timber
#

I've registered a listener that uses ChatChatEvent but it's not being triggered according to my breakpoints, has this event been tested?

lyric gyro
#

the fuck is a ChatChatEvent

torpid raft
#

when the chat sends a chat of it's own accord

lyric gyro
#

i get that it's WIP, but you don't make a multiplatform plugin by tying the public API to a specific platform, lol

dense drift
#

Is it supposed to be multiplatform?

#

Or you are talking about spigot and bungee

lyric gyro
#

I mean either case the answer is "yes"