#help-development

1 messages Β· Page 543 of 1

flat ruin
#

^

chrome beacon
#

Sounds like a good use case for the event I mentioned

flat ruin
#

(crazy!)

unique bay
#

what

flat ruin
#

not you

unique bay
#

oh

quaint mantle
#

me

unique bay
#

what should I be using instead

chrome beacon
flat ruin
#

^

unique bay
#

it doesn't need a local variable?

chrome beacon
#

?

unique bay
flat ruin
#

then you should not be making a minecraft plugin

unique bay
#

in this case, how can I make sure config is a local variable

flat ruin
#

learn java first

unique bay
#

I'm learning java via making plugins

flat ruin
#

bad choice lmao

unique bay
#

it's how I learn

unique bay
hazy parrot
#

Assuming you already have basic programming knowledge

flat ruin
#

I mean yeah true

#

I do java for my job so I guess I was just taught to learn then do first

#

Β―_(ツ)_/Β―

shy rock
#

Wanted to start organizing my plugin in order to add more features, anybody knows how to connect the starting file to the skeleton file?

agile anvil
#

What do you mean ?

chrome beacon
#

They want to know how to access another class I guess

#

Which means it's time to learn Java

agile anvil
#

Oh 🀑

shy rock
#

Same code doesn't work on a different java class

chrome beacon
#

?learnjava

undone axleBOT
hybrid spoke
twilit roost
#

any ideas why my Interactions are off grid?
Im spawning them exactly where I spawn those Block Displays

#

?paste

undone axleBOT
hybrid spoke
#

add 0.5

twilit roost
#

oh

#

is this bukkit stuff or just easy fix in my case

hybrid spoke
#

the block center is always 0.5

worldly ingot
#

Origin of the entity is just in the bottom left

twilit roost
#

oh ok
tysm

tall furnace
karmic mural
#

When I have an eventlistener does it need to be public?

eternal night
#

highly encouraged

opal juniper
#

what happens if it isn’t? More reflection?

karmic mural
#

Curiosity, I suppose? I'm just trying to do stuff by the book and afaik if it doesn't need to be public, it shouldn't be

quaint mantle
#

Who make mods?

#

Who know make mods

pseudo hazel
#

mods?

livid atlas
#

This is seemingly just what i wanted, can't believe it took me this long to find it
anyone know how to apply this in any way shape or form?? i have no knowledge on how to compile plugins πŸ’€
here's the link from that thread: https://gist.github.com/aadnk/3928137

Not even sure this code works anymore, it's very old from the looks of things..?

ivory sleet
#

but yeah u compromise it with unnecessary accessibility

glossy venture
#

nvm class probably cant be private

karmic mural
ivory sleet
#

nanos prob

#

like its negligible

#

but it may be impactful if u scale it enough

#

and java is just making reflection faster with new releases

#

I just use public so I can unit test if needed

karmic mural
#

But on the other hand, would there even be any potential issue with leaving the modifier public?

ivory sleet
#

well

livid atlas
ivory sleet
#

semantic accessibility modifiers in java like private, protected, (sealed)... etc are just there to make be able to defend ur code against the world

#

cuz we are humans after all hence capable of just so much trouble

#

Thing is this is how I think

#

sure its public when it does not need to be

#

however all listeners are at the bottom of your abstraction hiearchy anyway

#

(or well they should be)

#

therefore no other class of yours should in principle have your listener classes as dependencies of their own

#

like also u have to code with the intention that people aren't going to deliberately sabotage your system (since in reality thats really easy to do, just reflection, unsafe etc)

glossy venture
#

i know i mean the listener class probably cant be private because Class doesnt have a setAccessible method

#

no shit

#

didnt i say class

#

listener class

#

im pretty sure you cant set shit as accessible if the class is inaccessible to you

tardy delta
#

invokespecial being faster than invokevirtual ig

glossy venture
#

yeah it is

tardy delta
#

isnt invokestatic even more faster?

#

cuz no object ptr dereferencing

glossy venture
#

probably because it doesnt need an instance

glossy venture
#

but pushing parameters probably takes longer

tardy delta
#

ye

karmic mural
#

On the other hand, I'm having some issues with my plugin. Code pasted below.

Basically... It runs the funciton if the itemData matches "ItemDataValue"... But it doesn't do it? This is a custom recipe item, and it only works if I craft a fresh item. But then suddenly it breaks, I can't figure out why it breaks, but it does. Then, despite the data being identical, it just doesn't run the function. I printed out the itemData to be sure, and it always says "ItemDataValue" but if the item isn't freshly crafted it just doesn't work...


        String itemData = meta.getPersistentDataContainer().get(_keyCache.getKey("keyname"), PersistentDataType.STRING);
        if (itemData == "ItemDataValue"){
            new Function(e);
        }

glossy venture
#

use . equals for strings

karmic mural
#

That's what I was looking for, thank you

glossy venture
#

== is unreliable

tardy delta
#

i wanted to say that but i was typing on the wrong screen πŸ’€

karmic mural
#

I completely forgot that... I knew I solved this issue before lol

#

Any clue as to why this is an issue in the first place? Never seen it any other language

glossy venture
#

sometimes forget that too

glossy venture
#

it occasionally works because most strings not explicitly created with new String come from the string pool

tardy delta
#

cuz if you dont use a string literal, you are making a new string object and compare it with a literal, which is stored in another place in memeory, those two addresses dont equal so it will return false

#

meanwhile in c++ you just have == uwu

karmic mural
#

I see, that does make sense. I assume it would be solved if I made a new String like String checkFor = "ItemDataValue" too?

glossy venture
#

nah

karmic mural
#

same issue?

tardy delta
#

its not the "ItemDataValue" that is the problem, that one is stored in the readonly memory section of you program

glossy venture
#

PDT might be deserialized in which case the value is created with new String(byte[])

tardy delta
#

your itemData is a new string object made during runtime

glossy venture
#

essentially == compares the reference and .equals() compares the data

karmic mural
#

I see, thank you for the explanation :)

glossy venture
#

and it just happens to sometimes work because the value might come from the string pool

karmic mural
glossy venture
#

so yeah always use .equals

tardy delta
#

::intern() πŸ’€

glossy venture
#

but thats unreliable across platforms and data sources so just use .equals()

karmic mural
#

You see, I had this issue before and I just forgot how I solved it... I solved it the same way then as now, I just forgot. I guess that's what I get for working on this once a decade πŸ’€

glossy venture
#

lmao

livid atlas
#

How can I build a plugin with visual studio 2019? is it even possible?

glossy venture
#

nah thats C#

livid atlas
#

only? damn

glossy venture
#

well maybe if you install a plugin to code java

tardy delta
#

can vs even work witj java

karmic mural
karmic mural
glossy venture
#

but i strongly recommend IntelliJ

livid atlas
#

ok

#

i'm very new to all this man, i just wanted to compile this plugin from a src but it doesn't come with anything but the code

#

:P

tardy delta
#

just go get intellij then, it will ask you to build

glossy venture
#

does it come with a gradlew file?

#

or a pom.xml?

livid atlas
#

nope

#

just 2 .java files

#

πŸ’€

glossy venture
#

oh nvm then

tardy delta
#

who even puts that in a gist πŸ’€

glossy venture
#

yeah install intellij and copy paste shit

livid atlas
#

alright

livid atlas
#

xd

#

i can't seem to add dependencies

karmic mural
livid atlas
#

i have no clue how

karmic mural
#

IDK man VS is kinda useful for C#

#

Pays well

livid atlas
#

"click on Dependencies below Name" there is nothing of the sort

#

I AM

karmic mural
#

Well, it pays well where I live anyways

glossy venture
livid atlas
#

dawg there's just 2 .java files

#

i have to set this shit up

#

myself

#

😭

karmic mural
livid atlas
#

because i said it earlier

#

assuming you read the earlier posts

#

🀨

#

whatever

#

i just

#

need help with this

karmic mural
#

Same thing :P

#

In my case, anyways

livid atlas
#

so in project strcutre and modules

#

apparently there's supposed to be a thing to add dependencies

#

i do not see it

hazy parrot
#

why ?

#

how is it different then javas

#

aside from namespaces

karmic mural
#

Idk why but basically everyone uses ASP.NET here, man

tardy delta
#

some people do

livid atlas
tardy delta
#

dont either

livid atlas
#

i can't see it when i click on my project

#

:P

karmic mural
#

Not like this?

void MyMethod(){

}
livid atlas
#

ioh wait shit

#

it's there now nvm

#

it literally wasn't there before, think i know why though

tardy delta
#

i dont see c++ people care much about conventions

karmic mural
#

πŸ€·β€β™‚οΈ

tardy delta
#

you can be happy if you have a ```cpp
void My_Fancy_Method()
{

}```

karmic mural
#

Unless the IDE makes the opening bracket go one line down I'm not gonna change how I write it lol

vital sandal
livid atlas
#

okay this is ridiculous, now "src" isn't there

karmic mural
#

Had to pull up a project to be sure... Turns out the class I looked at hadn't been formatted fully so the one method I looked at was incorrect lol

glossy venture
#

is there a way to extend numbers in java? like short to int but without it needing to keep its value, i just want to pad it with zeros

karmic mural
#

I much prefer having the opening bracket on the same line as the function name, though

vital sandal
#

:l you can still do it as you wish

#

Even if you write everything on one line it is still doesn’t matter

glossy venture
#

since java is little endian (int) myShort will place the short bits at the end of the int to preserve the value

#

but idc about the value i just want to extend it with zeros

karmic mural
vital sandal
#

For C it is just annoying about pointer and stuffs

tardy delta
glossy venture
#

no i mean bitwise

#

shouldve clarified

#

like byte -> short would be 0xFF -> 0xFF00

tardy delta
#

so padding zeros on the right?

glossy venture
#

yeah

tardy delta
#

frostalf probably knows

glossy venture
#

maybe i can do (int)myShort << 16

tardy delta
#

what runs first, the cast or the shift?

glossy venture
#

cast is higher priority

#

i think

#

yeah

tardy delta
#

makes sense to me

#

@glossy venture supposed to work like this?

glossy venture
#

yeah

vital sandal
#

And yeh C does things greatly It allow you to work with memory address

#

But not that flexible

glossy venture
tardy delta
#

figuring out dangling poiinters is fun

glossy venture
#

isnt new byte[len] just the same as malloc

#

but managed

#

there already is Unsafe#allocateMemory though

tardy delta
#

or leaves them unitialized?

glossy venture
tardy delta
#

ah lol doing chess now

#

i thought you were doing your java extension thingie

glossy venture
#

oh nah

tardy delta
#

that clearly looks like overflow

glossy venture
#

got bored so ima continue later

#

holy shit it finally worked

#

need to do all of this shit because java does not have structs

#

and using objects would fuck the heap

#

ill use swing

tardy delta
#

i cant even play chess

#

does java have a raylib impl?

glossy venture
#

directly render shit with Graphics2D tho not doing actual swing shit ever

tardy delta
#

otherwise opengl

glossy venture
#

why not swing lmao

#

i wont use the components

#

only canvas

#

it wont look shit i promise

tardy delta
#

i only render stuff in odin (yes thats a lang)

tardy delta
#

oh there are java bindings for raylib

glossy venture
#

graphics2d is nice

quiet ice
#

But sooo slow

glossy venture
#

im not doing fucking opengl for chess

#

because im stupid and i dont know what im doing

#

i cant be bothered to spend time on the gui

quiet ice
#

Well then you don't have to bother about performance in the first case

glossy venture
#

the gui isnt heavy

#

the chess engine needs to be fast

#

yeah

#

i am

#

idc about the gui as long as it doesnt crash everything

#

nah i know but i tried in C++ and i got segfault in creating the board so fuck that

tardy delta
#

is it (or will it be) on github?

glossy venture
#

yeah i will try to make it kind of a library

tardy delta
#

i like looking at your code

quiet ice
glossy venture
#

lichess most likely, like all other apps and sites, uses UCI

quiet ice
#

It's THE open source chess website

glossy venture
#

to communicate with external engines

#

like stockfish

quiet ice
#

UCI?

glossy venture
#

so the engine doesnt need to be written by them

glossy venture
livid atlas
#

how do i use ProtocolLib

#

?

tardy delta
#

yall playing chess?

quiet ice
grizzled oasis
#

Is possible to add more sounds to minecraft and make them play with a plugin? (obv with texture pack)

grizzled oasis
#

ok found everything

glossy venture
#

why is this so painful

#

this took me like half an hour

tardy delta
#

<<=

#

doesnt that exist

quiet ice
glossy venture
#

hhm

#

thx

#

didnt think that would work

#

because of other values packed in the int

quiet ice
#

(technically there is a difference between << 16; >> 25 and >> 9 but due to the bitwise AND the diff is not of relevance)

glossy venture
#

ah

quiet ice
#

Packing with negative values can be a pain

glossy venture
#

dont think ill need to do that

quiet ice
#

Yeah then it is easy

glossy venture
#

you mean packing signed values?

quiet ice
#

for negative values you'd need to do stuff like

    public static long hashPositions(int x, int y) {
        // We make use of (y & 0xFFFFFFFFL) as otherwise y values such as -1 would completely override the x value.
        // This is because `long | int` automatically casts the int to a long, where as the cast is by decimal value
        return (((long) x) << 32) | (y & 0xFFFFFFFFL);
    }

for reading I don't exactly recall how it works

glossy venture
#

tf

quiet ice
#

Though I believe reading/unpacking is rather easy as you can just reapply the bitmask and cast

#

i.e. for reading x you'd do (int) (value >> 32) and for reading y you'd do (int) (value & 0xFF_FF_FF_FFL)

#

Honestly the bitwise operations are rather easy but I've been in contact with those ever since I started modding galimulator (you tend to use them quite a lot for manipulating bytecode) so yeah my perception has become skewed since then

fierce salmon
#

I am trying to make a plugin that times how long it takes for a player to complete a parkour course and I want to add a leaderboard hologram for the player who completes the course in the fastest time. How can I store the parkour values so I can add them to a leaderboard hologram?

young knoll
#

Store it in a database

#

Or just a file if you want

uncut plank
#

Hello, I'm trying to place some items into a custom SMITHING inventory but items are not placing

Code:

                null,
                InventoryType.SMITHING,
                "...");

        inventory.setItem(0, new ItemStack(Material.APPLE));
        inventory.setItem(1, new ItemStack(Material.IRON_INGOT));

        player.openInventory(inventory);```

In-game result: https://prnt.sc/q95ayEwtYxzo
#

I tried to cast the inventory to SmithingInventory but it's giving ClassCastException. Is there a solution for them (or for any)

tardy delta
#

πŸ€”

agile hollow
tardy delta
#

that your own plugin that disconnect.spam thing?

tardy delta
#

dunno if thats caused by that luckpermsvelocity plugin or not, should probably get to #help-server

worn tundra
uncut plank
# worn tundra What sort of classcastexception was it giving?

Code:
```Inventory inventory = Bukkit.createInventory(
null,
InventoryType.SMITHING,
"...");

    SmithingInventory smithingInventory = (SmithingInventory) inventory;


    player.openInventory(smithingInventory);
Error:
``Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventoryCustom cannot be cast to class org.bukkit.inventory.SmithingInventory (org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventoryCustom and org.bukkit.inventory.SmithingInventory are in unnamed module of loader java.net.URLClassLoader @3f8f9dd6)``
worn tundra
#

Does updating the inventory do anything?

tardy delta
#

maybe the fact that its experimental and the note

uncut plank
worn tundra
#

Without the casting

uncut plank
uncut plank
#

let me test

#
  player.updateInventory();```
Didn't change anything
worn tundra
#

Hmm

uncut plank
worn tundra
#

Okay so uhh

#

How do I tell you this

#

Just ran this code on 1.19.4

tardy delta
#

calling ::addItem?

worn tundra
#
            Inventory inventory = Bukkit.createInventory(null, InventoryType.SMITHING, "meow");
            
            inventory.setItem(0, new ItemStack(Material.DIRT));
            inventory.setItem(2, new ItemStack(Material.GRASS_BLOCK));
            
            player.openInventory(inventory);
tardy delta
#

dunno i never used smithing inventories

worn tundra
#

Works perfectly fine

tardy delta
#

slot index correct?

uncut plank
#

Tested in 1.19.2, let me test in 1.19.4

uncut plank
# worn tundra

Updating the server version to 1.19.4 is solved the problem, thanks

fierce salmon
quaint mantle
#

can i move the craftingtable to the player gui?

#

i mean i wanna craft everything in gui

lavish robin
#

If I specify text to be bold with ChatColor.BOLD how do I specify when the bold should end. I am trying to do somthing like: normal text bold text normal text.

remote swallow
#

ChatColor.RESET

quaint mantle
#

i cancel the craftitem event works but i see crafted item can i disable to show this ?

young knoll
#

PrepareItemCraftEvent

#

set result to null

ocean hollow
#

how to spawn an entity 0.5 blocks to the left of it?

pseudo hazel
#

to the left of what

ocean hollow
#

summon blue entity

pseudo hazel
#

just add 0.5 to the position.x or whatever

hasty prawn
#

That wouldn't always be to the left

ocean hollow
pseudo hazel
#

get where its facing towards, create a vector pointing to that position rotated by 90 degrees

#

x 0.5

lavish robin
#

Look at the rotation of the red entity and do trig to get the coords to spawn the blue entity?

pseudo hazel
#

not really trig but close enough

hasty prawn
#

Yeah you're gonna have to use trig to get the left vector of the entity and then add that vector to it's position

rain patio
#

Hello, I am trying to develop a local chat for a plugin that I am making, and I'm using luckperms with my plugin as well. When I type in global chat, the prefixes and suffixes show, but when I use local chat which has its own format, it only shows the username and nothing more.

In short, player.getDisplayName isn't getting the prefix and suffix and I have no clue how to fix it I have been googling for like 30 minutes, any help is appreciated

ocean hollow
pseudo hazel
#

idk

#

depends on what functions the Vector has

hasty prawn
#

Neither am I. There should be plenty of information online for getting a left vector though, getting directional vectors is fairly common in Game Dev

hasty prawn
rain patio
#

oh alright

hasty prawn
#

Or retrieve them any other way you can. If you've set them manually then using their API is gonna be the easiest and most consistent way probably

quaint mantle
#

how can i add equal for the #PrepareItemCraftEvent
example paper.hasItemdata players can't craft map

#

need i get player ?

#

or this event have method for check crafting slots ?

remote swallow
#

`if (event.item.hasItemMeta()) setResult())

shadow night
#

if I want to follow an arrow and just for example lets say log its data, will I have to setup a loop that will get the data every tick or is there some kind of tick event?

quaint mantle
#

or crafting slots ?

remote swallow
#

you should know where the item you want to check will be

quaint mantle
#

i will try

#

or wait

quaint mantle
remote swallow
#

get the inventory and loop slots

quaint mantle
#

ah ty

shadow night
#

If I have this code
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, () -> {}, 0, 1) how do I stop the loop from inside the loop?

young knoll
#

replace () -> {} with task -> {} and then you can use task.cancel

shadow night
#

okay, thanks

quaint mantle
#

this.cancel(); ?

shadow night
#

and in my class there is no cancel function soo

pseudo hazel
#

iirc this refers to the anonymous class if you are inside any

rotund ravine
#

this refers to the current context

lavish robin
#

Is there a way to do getItemMeta but get the actual item meta instead of a copy?

rotund ravine
#

It is not a mutable copy no.

flint coyote
#

No. You'd need to get it via reflection

rotund ravine
#

ItemMeta is constructed via the nbt data.

river oracle
#

:> mutable item meta sounds safe reflection time

unique bay
#

why my plugin no work!!

flint coyote
#

I can't think of a reason to get the actual item meta

young knoll
#

Because setItemMeta is hard

rotund ravine
#

It's a reflection of the nbt data.

river oracle
#

Get good ar coding and try again

unique bay
flint coyote
lavish robin
#

So does getItemMeta returned item update to reflect the actual item meta?

river oracle
young knoll
#

getItemMeta returns a copy

rotund ravine
#

what

unique bay
#

I'm kidding I just don't know how to ask my question without sending a big block of code

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

undone axleBOT
glossy venture
#

holy shit finally this shit passed

rotund ravine
#

We are used to look at massive blocks of code

unique bay
#

bro is making chess in minecraft

unique bay
river oracle
#

Thay way nothing gets lost

rotund ravine
unique bay
#

oh I think I fixed my own issue hold on

river oracle
#

?paste

undone axleBOT
flint coyote
rotund ravine
#

I'd be surprised if you didn't look at blocks of trash daily ahaha

shadow night
unique bay
#

i forgot to save the config to file ☠️

river oracle
flint coyote
#

Why the kotlin hate

rotund ravine
remote swallow
rotund ravine
#

so suck a fat one

unique bay
#

calm down girlypops

river oracle
#

Shut up

rotund ravine
#

We are just having fun ahaha

unique bay
#

make me

river oracle
#

Go delete your discord

unique bay
#

i'm gonna touch your accountI did, in my phone

flint coyote
unique bay
remote swallow
#

real

unique bay
rotund ravine
#

Go on the spigot forums and loose braincells

shadow night
# shadow night hmm

Ig I'll just use the deprecated timer task with BukkitRunnable because it has cancel()

unique bay
#

I'm gonna make a swear jar plugin

#

everytime you swear, you lose a thousand real life dollars

river oracle
#

Genius

rotund ravine
rotund ravine
#

?jd-s

undone axleBOT
river oracle
#

πŸ₯³

unique bay
#

you need to connect your credit card to join

#

that sounds like something I'd actually do with friends tbh

shadow night
glossy venture
#

fastutil is so nice but so fucking big the jar immediately becomes multiple megabytes big which sucks

rotund ravine
#

Cause ur doing it wronnggg

unique bay
#

so it turns out i didn't fix it

#
            if (!playerFile.exists()) {
                playerDataFolder.mkdirs();
                try {
                    playerFile.createNewFile();
                    YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
                    playerConfig.set("balance", 0);
                    playerConfig.save(playerFile);```
#

empty file

flint coyote
rotund ravine
#
new BukkitRunnable .... .runTaskTimerAsynchr(plugin)...
unique bay
quaint mantle
#

i want to make some kind of calculator a player can use in the chat like :
"i need 10+4 stacks of wood",
and it would just convert it to 14 but rn im kinda strugeling to think of some indicator to use it because it would be annoying if it would apply to everything yk

#

anyone got a idea that would make that easier to control

unique bay
#

I have finals in 5 days from now yet i'm out here coding my first plugin

flint coyote
#

until you hit a space in both directions

unique bay
#

goat dang it why won't it save

quaint mantle
#

no clue what you are trying to say xd just to make sure i know how to code it i just dont know what to use. First i thought maybe put like a % or something infront the msg if something should be converted but then i though thats to hard to remember or to annoiyng to use

#

im just not sure how to make it user friendly

unique bay
#

so like a player says "32+8" and it spits out 40?

quaint mantle
#

yh

#

but also with devison multiplication etc

rotund ravine
#

You can use a framework

#

or be sketcy and use a js eval thing

unique bay
#

i think what he means is that when a sign like "+" is found, you keep taking every number before and after it until you hit a space in each direction, that way you know the number is done

rotund ravine
#

@tardy delta

#

These guys wanna emulate you

quaint mantle
#

did he do something like this before?

rotund ravine
#

He's been working on it for months

quaint mantle
#

i just kinda wanna do it bc im having a math exam coming up and i wanted to do something with math xd

rotund ravine
#

Do particle effects

tardy delta
flint coyote
#

if you wanna support full expressions that's not as easy as it sounds

tardy delta
#

just gotta figure out where the math is

quaint mantle
#

xD

#

yh i will take a look at that thx

unique bay
#

now can someone save my ass

quaint mantle
#

bc of exam?

unique bay
#

what

#

my file just won't save

fierce salmon
#

How do I check to see what a specific value in my configuration file is?

flint coyote
#

wdym by specific value?

#

Value behind a key?

quaint mantle
fierce salmon
unique bay
#

real

flint coyote
#

huh

unique bay
#

ok now how do i save my config file

quaint mantle
#

what kind of config file

#

is it a custom config

unique bay
#
File playerDataFolder = new File(getDataFolder(), "playerData");
            File playerFile = new File(playerDataFolder, playerID + ".yml");

            if (!playerFile.exists()) {
                playerDataFolder.mkdirs();
                try {
                    playerFile.createNewFile();
                    YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
                    playerConfig.set("balance", 0);
                    playerConfig.save(playerFile);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                saveResource(playerID + ".yml", false);```
flint coyote
rotund ravine
#

It would return true or false

rotund ravine
rotund ravine
#

that's dumb

flint coyote
#

Yeah but he literally said "check to see what a specific value is in my configuration file" - fixed some grammar

unique bay
unique bay
#

get then

flint coyote
#

yes

rotund ravine
#

simple get

quaint mantle
#

get then

unique bay
#

i'm finally starting to get used to this

fierce salmon
#

nvm I figured it out

#

its just .set()

quaint mantle
#

@unique bay

Java
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;

import java.io.File;

public class ConfigUtil {
    private File file;
    private FileConfiguration config;

    public ConfigUtil(Plugin plugin, String path) {
        this(plugin.getDataFolder().getAbsolutePath() + "/" + path);
    }


    public ConfigUtil(String path) {
        this.file = new File(path);
        this.config = YamlConfiguration.loadConfiguration(this.file);
    }

    public boolean save() {
        try {
            this.config.save(this.file);
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }

    }

    public File getFile() {
        return this.file;
    }

    public FileConfiguration getConfig() {
        return this.config;
    }
}

i normally use this when ever dealing with configs. When ever you save somethin in a file it either creates the file or loads it up and changes it if it exists

#

works fine for me

#

honestly no clue where i found it anymore

unique bay
#

that's alot

remote swallow
#

epic java code block fail

unique bay
#

real

quaint mantle
#

its just one class u can use over and over again

#

have it in a seperate class and call it up when needed

unique bay
#

I don't even know how I would do that yet

quaint mantle
#

like iths

remote swallow
#

you should be saving 1 instance of it,, not creating a new one every time you want to use it

quaint mantle
#

and if you want to get the saved data you would do this

#

ofc again with the same instance if possible

#

epics right about that

remote swallow
#

iirc you can extend YamlConfiguration or FileConfiguration and be able to do config#getLocation

unique bay
#

real!!

echo basalt
#

extensions are barely used when it comes to bukkit

echo basalt
#

bit annoying

unique bay
#

my balance is still not saved in the file πŸ’€

echo basalt
#

meanwhile I made a minigame lib where you gotta extend literally anything and just add to it

unique bay
#
            File playerDataFolder = new File(getDataFolder(), "playerData");
            File playerFile = new File(playerDataFolder, playerID + ".yml");

            if (!playerFile.exists()) {
                playerDataFolder.mkdirs();
                try {
                    playerFile.createNewFile();
                    YamlConfiguration playerConfig = YamlConfiguration.loadConfiguration(playerFile);
                    playerConfig.set("balance", 0);
                    playerConfig.isSet("balance");
                    playerConfig.save(playerFile);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }```
#

wait

#

idk why I added the isSet

quaint mantle
#

do you only want to save the balance in there with idk the uuid?

unique bay
#

I just wanna save the balance

#

the UUID is the file name

quaint mantle
#

because then why not just do it in the same file?

#

and set the uuid in there to the balance

unique bay
#

you lost me there

#

I only wanna save the balance to the player file

remote swallow
#

databases be like

quaint mantle
#

make a file called "balance"
uuid1: 10$
uuid2: 69$

quaint mantle
unique bay
#

how is it any better than just having a file for each player

quaint mantle
#

i mean you would have to open way less files. Would definetly save you some space if you have many players

unique bay
#

but to find one player's balance, it'd have to go through every single UUID in that file?

quaint mantle
#
    @EventHandler
    public void get(PrepareItemCraftEvent e) {
        CraftingInventory test = e.getInventory();
        for (ItemStack item : test.getMatrix()) {
            if (item.getType() == Material.PAPER){
                test.setResult(null);
            }
        }
    }``` how can i cast this error ?
#

no just get the balance set to that once uuid

remote swallow
remote swallow
unique bay
#

I still don't know how do that, I'm just happy with saving it to per-player files for now

unique bay
#

i'm unsure

quaint mantle
#

what u think ?

remote swallow
#

that hurts

quaint mantle
#

if you were to use the code i send before you could for example:
ConfigUtil config = new ConfigUtil(plugin, "balance.yml");
config.getConfig().geInt(uuid);

#

πŸ˜„

analog snow
#

weyooo

remote swallow
#
for (ItemStack stack : test.getMatrix()) {
    if (stack == null || stack.getType().isAir()) continue;
    if (item.getType() == Material.PAPER) {
        // do stuff
    }
}
analog snow
#

what did he say

quaint mantle
#

im underage sir

unique bay
#

so am i

analog snow
#

xD

unique bay
#

why is this not saving

glossy venture
unique bay
#

oh god, you remember that rule

#

are you actually coding chess in minecraft

glossy venture
#

nah its standalone

#

but i am coding chess

unique bay
#

that's hot

glossy venture
#

im making an engine tho

#

like an AI

#

otherwise i wouldnt be over optimizing shit so much

hybrid spoke
#

for chess?

glossy venture
#

this bitwise fuckery is a pain

hybrid spoke
#

have fun with that

tardy delta
#

reminds me i need to implement A* pathfinding for my sheep

#

its kinda scuffed now, man just going places

quaint mantle
glossy venture
#

bit boards are pretty smart

#

i just realized though memory usage on the board instance doesnt matter

#

so if an array is faster i can just use that

tardy delta
hybrid spoke
#

or never touched java

river oracle
thick gust
#

is sm1 used to intelliJ? I cant export my plugin (artifact)...

echo basalt
#

don't use pathethic pls

quaint mantle
river oracle
echo basalt
#

weird ass pathfinding will make your sheep fly

quaint mantle
river oracle
river oracle
#

you use it for big numbers sir

echo basalt
#

it's decent 3d pathfinding

#

it's just that it doesn't respect gravity

hybrid spoke
quaint mantle
hybrid spoke
river oracle
#

re: no

quaint mantle
unique bay
#

i think i know his issue

tardy delta
echo basalt
#

I tried

#

wasn't a fan

unique bay
#

he's trying to export his plugin as an artifact rather than using the literal build system to build it

hybrid spoke
unique bay
#

which is what I did and it didn't work for me, until I used the build system

tardy delta
#

the thing is that im primarly doing this in minestom but ye idk

thick gust
river oracle
quaint mantle
unique bay
thick gust
quaint mantle
#

i started without a build system too for first timers its better i believe so they dont get lost

thick gust
#

when building it, the directories don't get created

quaint mantle
river oracle
#

probably should fuck around with some basic java stuff

#

and move onto a build system asap

unique bay
#

(i'm a beginner)

#

I only knew python and GDscript before tbh

quaint mantle
hybrid spoke
#

especially for beginners a plugin can be a good first project to learn from

quaint mantle
#

i think so too

hybrid spoke
#

you just shouldnt only focus on plugin development

hybrid spoke
#

because otherwise you get that "oh thats java" thought from spigot

unique bay
#

I'd rather learn java while getting used to my build environment and plugin APIs rather than slowly burning out learning entire new concepts everytime you wanna try something else

river oracle
#

Was my first project too, doesn't mean its for everyone, you should just always use a build system even if its overwhelming at first you don't even need ot understand it right away

#

I copy pasted my pom for the longest time, I still do now (its just cuz I'm lazy though)

quaint mantle
#

idk why yall hate artifacts so much they work just fine for beginners xd

hybrid spoke
#

you were talking about java

thick gust
hybrid spoke
#

not a build system

thick gust
#

so how to setup a build system?

hybrid spoke
#

?bing

undone axleBOT
unique bay
#

i'm gonna dm god cipher

quaint mantle
unique bay
unique bay
remote swallow
#

YEAHHHHHHHHHHHHHHH

#

GRADLE

river oracle
unique bay
#

(i have no idea what the difference is)

tardy delta
#

fuck gradle

hybrid spoke
quaint mantle
unique bay
quaint mantle
unique bay
#

gradle is so hot

#

it's never let me down

hybrid spoke
#

gradle come with aids

#

you really want that?

unique bay
#

good

analog snow
#

weyoo

unique bay
#

life long connection

remote swallow
#

gradle is 14

unique bay
#

no matter how short that life is

hybrid spoke
#

i mean you will never forget that night for sure

unique bay
echo basalt
#

gradle's old enough for discord

quaint mantle
unique bay
#

I still have my question left unanswered man

unique bay
analog snow
glossy venture
#

holy quacamoly

unique bay
#

what the fuck

quaint mantle
thick gust
glossy venture
hybrid spoke
thick gust
#

Exporting the artifact wroked once for me, then it suddenly stopped working.

unique bay
hybrid spoke
#

right click it and enable {idk what keyword that is} support

quaint mantle
tardy delta
#

wait checking contains on a set and then adding??

thick gust
tardy delta
#

so many double checks everywhere

unique bay
#
if player say /godmode:
  give(player, godmode)```
quaint mantle
hybrid spoke
unique bay
#

python api fixed

tardy delta
#

well actually

#

im kinda blind, but there are others too

#

😳

thick gust
analog snow
hybrid spoke
remote swallow
analog snow
quaint mantle
quaint mantle
analog snow
#

now its getting better

tardy delta
#

well just some overhead here and there

thick gust
tardy delta
#

not bad

thick gust
#

sm1 once explained me how everything works with intellij but i already forgot it πŸ˜„

quaint mantle
thick gust
#

doesn't export at all, as already said.

quaint mantle
#

aight so

#

did you set the correct export location?

thick gust
#

yes I did.

quaint mantle
#

lets do this the easy way just join my channel rq and screen share

remote swallow
#

self promo11111

analog snow
#

weyo self promo

hybrid spoke
#

as if spigot dont have vcs

quaint mantle
#

yh but im in a channel with someone else rn

#

dont wanna leave the poor guy

#

(he has no friends)

quaint mantle
hybrid spoke
quaint mantle
#

sure..

analog snow
#

(he's addicted to this discord)

hybrid spoke
#

seeing his name for the first time so

glossy venture
#

😭

thick gust
#

okay I dont know what I changed but now building does something

quaint mantle
thick gust
#

the progress bar at bottom right corner is back when building

glossy venture
#

i hate bounds checks

thick gust
#

but the file is still not extracting and I get an error code

quaint mantle
#

what error code

thick gust
quaint mantle
#

?paste

undone axleBOT
quaint mantle
#

use this

#

i have smol eyes

remote swallow
#

build completed

#

check output folder

thick gust
#

still no exported file...

quaint mantle
#

thats

#

weird

#

wait

thick gust
#

there is literally no classes folder

quaint mantle
#

version is the plugin for

thick gust
#

1.12.1

quaint mantle
#

what java version u using

thick gust
#

1.8

quaint mantle
#

java 1.8?.

remote swallow
#

yeah

thick gust
remote swallow
#

thats the old naming scheme

eternal oxide
quaint mantle
glossy venture
#

whats the opposite of diagonal

echo basalt
glossy venture
#

slow

#

too slow

echo basalt
#

switch statement

glossy venture
#

for?

echo basalt
#

less ifs

quaint mantle
#

under project structure

echo basalt
glossy venture
#

the performance is necessary

glossy venture
#

so like you have lines that align with axis

echo basalt
#

parallel

glossy venture
#

and then you have diagonals

#

aight

thick gust
#

got this selected

hybrid spoke
quaint mantle
hybrid spoke
#

still

thick gust
#

IntelliJ strangely recommended me yesterday to install some weird sdks in a sort of message on top right corner

glossy venture
#

idk if you know but chess is pretty complicated

hybrid spoke
#

still

glossy venture
#

couple million possible moves after like 2 moves

quaint mantle
hybrid spoke
#

and still

thick gust
#

Doesn't it make more sense to select a JDK instead of JRE?

glossy venture
hybrid spoke
#

you weight them

glossy venture
#

no i dont mean for the algorithm

echo basalt
#

^ that's how chess works

glossy venture
#

i mean as an alternative for the if statements

hybrid spoke
#

a - for - loop

#

switch

#

whatever

glossy venture
#

switch???

echo basalt
#

make a bunch of interfaces for each piece

glossy venture
#

lmao

hybrid spoke
#

a class for every possible move

echo basalt
#

List<Position> getValidMoves(ChessBoard board);

thick gust
#

Thanks.

echo basalt
#

use oop to your advantage

thick gust
#

It extracted now ^^

echo basalt
#

might as well be writing it in C if you want pure if checks

glossy venture
#

the OOP nature of java is a humongous disatvantage

#

but i cant be bothered to deal with memory

echo basalt
#

then don't use java

glossy venture
#

and java is fast enough if you do it correctly

#

so im using java

hybrid spoke
#

normally shit like that you do in python

quaint mantle
hybrid spoke
#

you would have to dig into machine learning for the chess engine

#

and there is python simply the best

glossy venture
#

best chess engines dont use machine learning

#

they just compute

#

maybe for eval

hybrid spoke
#

oh yeah they just validate every move and pick one random

thick gust
#

which artifact should I keep?

analog snow
glossy venture
#

btw c++ still > python for that shit

#

dont want to be running 20 secs per move

hybrid spoke
#

nah

quaint mantle
hybrid spoke
#

looks like you dont know what you are talking about

glossy venture
#

lmao

analog snow
#

lmao

quaint mantle
glossy venture
#

stockfish, the best chess engine in the world, evaluates positions with a neural network

#

but still uses classical minimax at its core

#

with major optimizations of course

hybrid spoke
#

congrats

#

you just counter yourself

analog snow
#

Guys, we all now that Scratch is the best language for Chess...

glossy venture
#

yeah not for running the fucking engine though??

#

the training is fine

#
  • a classical evaluation function is more than enough for 3200+ rated chess
hybrid spoke
#

i would give you a big fat what emote if i would still boost this server

candid kindle
#

what would you guys consider static abuse

glossy venture
#

stockfish is open source

#

its in C++

#

what can i say

analog snow
#

nah stockfish is coded in scratch

hybrid spoke
#

how does that make python bad for running the engine lmao

glossy venture
#

because minimax in python would take years lmao

hybrid spoke
#

oh yeah minecraft is done in java so java is superior for games

quaint mantle
#

Python is slower then @analog snow on heroin

analog snow
#

fr

glossy venture
#

lmao

analog snow
#

lmao

glossy venture
#

java is faster

quaint mantle
glossy venture
#

than python

analog snow
#

same

glossy venture
#

and i dont want to wait seconds between moves

#

for it to play

#

a mediocre move

#

i dont give a fuck about what is coded in java or in python java is objectively faster at most tasks

thick gust
#

when I went from Eclipse to IntelliJ the encoding kind of changed. how can I revert it back? There was once a message on top right corner which told me to change encoding and it worked only for a while, now this message doesn't come up anymore.

analog snow
#

python is good if you wanna do something quick (requests etc)

glossy venture
#

python: dev time good, performance bad
java: dev time mid, performance high-mid
C++: dev time pretty bad, performance highest

quaint mantle
#

yep. Python is a greate language and has its highlights but it just works way to slow for stuff like this.

tardy delta
#

what about rust

analog snow
#

oh no

glossy venture
#

i love python for shit like developement tools but i wont use it for a mf chess engine

quaint mantle
glossy venture
#

maybe better dev time or smth

analog snow
#

btw is Rust coded in rust?

tardy delta
#

wasting less time writing header files

quaint mantle
#

idk about u guys but i preferbly code in LolCode

wise mesa
wise mesa
analog snow
#

thx didn't know :D

quaint mantle
thick gust
#

@quaint mantle u know how to change encoding for entire project in IntelliJ?

tardy delta
wise mesa
#

Not 100% rust

analog snow
tardy delta
#

llvm code is compiled to assembly isnt it?

wise mesa
wise mesa
tardy delta
#

thats assembly

eternal night
wise mesa
#

Assembly is the step before machine code

#

It’s human readable

#

To a degree

#

Each instruction has a name

#

Most compilers skip that step

tardy delta
#

you're talking about the text representation now

quaint mantle
#

which event control player villager trades ?

#

TradeSelectEvent?

wise mesa
quaint mantle
young knoll
#

Afaik there is no event for when you actually complete the trade

#

Other than the InventoryClickEvent

quaint mantle
#

theres also this

PlayerInteractAtEntityEvent event
and
Inventorey click event

quaint mantle
glossy venture
#

how is it getting to this conclusion wtf

#

position 37 rank 8

#

wait rank 8 doesnt even exist

regal zodiac
#

Hi everybody, I would ask if you know which videos or wich channel is a good one to learn spigot in 2023 ? i'm actually java everyday but I want start to code on Spigot

thick gust
#

@quaint mantle exporting doesn't work anymore once again

#

I don't get it.

#

I got the correct export path and the correct java selected.

glossy venture
#

generated 3,160,412 move lists * 23 moves per list in one sec

#

idk how fast that is but 72,689,476 moves per sec sounds nice so lets go

quaint mantle
eternal oxide
#

yes

#

yuo shoudl process then close it

thick gust
quaint mantle
#

you sure it doesnt just replace the file?

thick gust
#

it doesn't.

quaint mantle
#

hm okay thats weird

thick gust
#

last time file was edited was 1h ago

#

thats why I know

quaint mantle
#

reload folder

thick gust
#

doesn't help xd

#

that doesn't change anything. it would only remove deleted files when refreshing a folder

quaint mantle
#

delete the file in the folder and try again

thick gust
#

I deleted the entire dir. Nothing happens..

#

No progress bar appearing in bottom right corner

quaint mantle
#

show me how you build it

thick gust
quaint mantle
#

what dependencies are you using

#

also what did you click here

thick gust
thick gust
quaint mantle
#

how many classes in your plugin

thick gust
#

why does that matter

quaint mantle
#

wanna see if its worth transfering

thick gust
#

33 classes

quaint mantle
#

damn

thick gust
#
  • 2 files (plugin.yml + config.yml)
quaint mantle
#

well

#

i would really recomend you to change to maven or gradle. It is way less trouble believe me

#

but kinda hard to move 33 classes i see

#

not sure if it will work

#

once you have maven

young knoll
#

It’s very easy to add maven or gradle to a project

#

At least in eclipse there’s just a menu option for it

quaint mantle
#

yh but wouldnt he have to manualy create the pom and add everything himself

quaint mantle
young knoll
#

It’ll create the pom for you

#

You’ll have to add spigot to it tho

quaint mantle
#

yh thats what i mean

young knoll
#

Not hard

#

You can basically just copy and paste from the wiki

thick gust
#

got the right window now as well

#

which options do I have now

quaint mantle
#

well first

#

you need to add spigot to your pom

#

normally it will do that manually when you use a certain creator

#

not in this case tho

#

did it create a pom.xml for you?

thick gust
#

yeah I got a pom.xml file in my project now

quaint mantle
#

okay

#

add this repository

#

in the repository section

#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

#

and this dependency

#

in the dependencies section

#

@young knoll did i forget anything?

thick gust
#
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>groupId</groupId>
    <artifactId>RPGPlugin</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
</project>
#

that's what I got currently

#

I have no dependencies section and no repos section

#

just add both below props?

quaint mantle
#

then just create them

#

yes

#

after that click this reload button

thick gust
#

sure that it's gotta be 1.14? xD

#

cuz remember, I'm using 1.12

quaint mantle
#

wait i will check what it is in your case

#

Only found it for 1.12.2

#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

thick gust
#

I assume it's

<dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot-api</artifactId>
    <version>1.12.1-R0.1-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>
quaint mantle
#

yh probally

#

just try

quaint mantle
thick gust
#

click where?

quaint mantle
#

new ui is weird

quaint mantle
thick gust
#

new ui is much cleaner

quaint mantle
#

and hides half the buttons

#

cant find anything there

thick gust
#

don't I have to click any option below?

#

install:install or smth like that?

quaint mantle
#

ig

#

normally u would just have to press that button

#

wait arent you missing the whole build part

#

?paste