#help-development

1 messages Β· Page 1172 of 1

somber scarab
#

I need the display name of for example "Dirt"

#

but I don't want the material name

#

so that when I hold a poppy it returns "poppy" and not "RED_FLOWER"

blazing ocean
#

Those are translatables

somber scarab
#
                    String itemBlockName = i.getItemMeta().getItemName();
                    p.sendMessage("item holding is: " + itemBlockName);```
somber scarab
quaint mantle
#

am looking for developer volunteer for experience and who wanna help out also trust worthy

#

dm me.

blazing ocean
#

They are rendered on the client dependant on the language

undone axleBOT
somber scarab
#

I just need it in english

blazing ocean
#

I'm not sure if there's an API method to get the English name

somber scarab
#

I don't want "WOOL" when I hold "Yellow Wool"

#

ugh

#

there has to be a way tho

quaint mantle
#

i cant post

river oracle
#

In offering developers

smoky anchor
somber scarab
somber scarab
#

but that's not the issue

#

the issue is Material names are different than what the User sees

smoky anchor
#

if you were on 1.21.2 you could probably get the item_name component, use the translatable to index into that versions lang file

#

you can possibly do the same on older versions, but idk the exact way

somber scarab
sullen canyon
#

there is one in pandaspigot

somber scarab
#

I'll just make do with materials

chrome beacon
#

The server does contain the en_us language file

#

Though you should probably just use a translatable component?

smoky anchor
#

or that lmao

somber scarab
#

hmmm

#

lemme try it

blazing ocean
#

Yeah I mean that doesn't work with the IM API :p

eternal night
orchid brook
#

HI, i have a backpack plugin, and when an item is placed in the backpack, I want to add <amount>x | in front of the item's name. The problem is that if the item doesn't already have a custom name, I'm not sure how to add this prefix while keeping the original Minecraft item name. I could use something like <amount>x | item.getType().name();, but that would display something like 194x | OAK_WOOD, which isn’t ideal. I really want to keep the item's default display name as shown by Minecraft.

public static ItemStack addAmountToTitle(ItemStack item, int amount) {
    ItemMeta itemMeta = item.getItemMeta();
    if (itemMeta != null) {
        String itemName = itemMeta.hasDisplayName() ? itemMeta.getDisplayName() : item.getType().name();
        itemMeta.setDisplayName(ColorUtils.color("&7&l" + amount + "x | " + itemName));
        item.setItemMeta(itemMeta);
    }
    return item;
}

is the only way is to use nms ?

sly topaz
#

@deft summit don't know what to tell you, because I just tested it and it worked fine for me lol

#

both in IJ and vscode

#

as a matter of fact, I had more troubles with IJ than with vscode lmao

deft summit
#

damn

#

maybe im just dumb lol

#

do you use gradle or maven?

sly topaz
#

maven

#

shouldn't have any effect tho

#

how does your attach configuration look like again, and how do you run your test server

deft summit
#

Test Server:

{
            "type": "shell",
            "label": "Start server",
            "command": "java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar ./paper.jar nogui",
            "problemMatcher": [],
            "options": {
                "cwd": "./.server",
            },
            "runOptions": {
                "instanceLimit": 1
            }
        },

Attach Config:

        {
            "type": "java",
            "name": "Attach",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005
        }
sly topaz
#

I just ran the server with this:

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -XX:+AllowEnhancedClassRedefinition -jar .\spigot-1.21.3.jar nogui

and this is my launch config:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Attach to Remote Program",
            "request": "attach",
            "hostName": "localhost",
            "port": "5005"
        }
        
    ]
}
#

I didn't run the server inside vscode tho, if that changes anything at all lol

deft summit
#

I doubt it, but I can try running it manually I suppose

sly topaz
#

also paper πŸ‘€

#

?whereami

deft summit
#

yeeee I know xD

#

I tried asking the question in the paper help discord, but they werent able to help either

#

and I thought "welp, it shouldnt matter what kinda server i have, right?"

#

I can also try doing it on spigot I guess

deft summit
sly topaz
sly topaz
#

well, JBR for the server, the attach process probably uses whatever JDK is set to my java home

#

which I believe is zulu 23

shadow night
sly topaz
#

it's for a test server anyway so it doesn't matter

shadow night
sly topaz
#

windows has way more safe-guards than linux to make sure you don't fuck up anyway so it's fine for the most part

shadow night
#

Most of the time you shouldn't need admin kek

sly topaz
#

not like I'm running actual servers in my personal pc lol

shadow night
#

I use powershell to not use admin

sly topaz
#

also chocolatey complains if you run it in user mode

shadow night
deft summit
sly topaz
blazing ocean
sly topaz
#

I imagine it makes UAC easily triggerable

blazing ocean
#

UAC?

deft summit
#

User access control

#

the popup you get for allowing certain things

river oracle
#

I swear every app on windows I've ever used requires administration privilages

#

its absolutely crazy

sly topaz
#

they're shitty apps then

#

well, more like old apps rather

river oracle
#

tbf yes ubisoft does make shitty apps

sly topaz
#

nothing that doesn't touch the system files should need admin privileges

river oracle
#

I forgot when I switched to daily driving linux already I feel like its been forever lol

sly topaz
#

I could never do that to myself again

#

just having things working is a bless

#

I just have too many programs which are windows only

river oracle
#

that sucks

#

I think I've been daily driving linux for like 2 years now

blazing ocean
#

I have for like 5 years

river oracle
#

tf are you parents like in tech or something??

#

aren't you only like 17

sly topaz
#

the only thing I hate about windows right now is how slow git is in comparison, but other than that eh

sly topaz
river oracle
#

but that's because I'm so used to gnome idk if I could go back

blazing ocean
blazing ocean
sly topaz
#

not liking windows UI
using gnome
something is wrong with these statements

river oracle
rough drift
river oracle
#

even when I did I was tech illiterate as fuck

sly topaz
#

I got my first computer when I was uhh, 11 I think? My mom decided to buy us one so we would stop asking for money to go to the cyber cafe

river oracle
#

stock gnome kinda is meh, but I customize mine a tad to fit my wants

#

mostly with the lack of task bar its unusable

blazing ocean
#

I didn't have my own PC for a good while, but I was usually able to use the family PC (nobody else really used it KEK)

rough drift
#

I got like a rPI at 7 or so and abused that thing to oblivion

blazing ocean
rough drift
#

before that I used the family pc

blazing ocean
#

I have a Pi 4 which I got a couple years ago

rough drift
#

pi2 babi

sly topaz
#

I wish I'd have a pi to play around with

#

would probably set it up as a pihole

rough drift
river oracle
blazing ocean
#

and not really customisable

river oracle
#

I've always found arduino is way more fun lowkey

eternal night
#

gnome mentioned stonks

river oracle
deft summit
sly topaz
#

arduino is fun, but not as powerful so you can't do as many fun things with it

deft summit
#

why tf is this 15mb

#

lmao

blazing ocean
# river oracle how?

Extremely unintuitive, shitty stock settings, no customisability, need plugins for anything, no tiling (iirc?)

blazing ocean
river oracle
#

well it isn't a tiling manager

#

if you want tiling use a tiling manager

blazing ocean
#

I do use one

rough drift
eternal night
#

looking forward to cosmic

river oracle
#

I prefer to actually have a usable computer though which is why I don't use one

rough drift
#

I found this on reddit

eternal night
#

but well, das a bit till its done

blazing ocean
#

I tried GNOME for like a month on my laptop

river oracle
blazing ocean
sly topaz
blazing ocean
#

and everything being left-oriented together with that padding looks weird

deft summit
#

xD

river oracle
#

is that a corrupted mp4?

deft summit
#

nah its just too big to be embedded i guess

#

dunno why

river oracle
#

oh I don't have VLC on my laptop

deft summit
#

idk if I accidentally recorded in 4k or smth x3

river oracle
#

I can't even decode it

blazing ocean
#

Wrong encoder ig

deft summit
#

ah, or that yeah

blazing ocean
#

Use x264 or some shit

rough drift
#

I wonder how people make the beautiful UIs I see at random lmao

deft summit
#

I have my OBS set to AV1, thats prolly the issue ye

river oracle
rough drift
blazing ocean
#

I could never make UIs outside of HTML or compose

blazing ocean
#

as in

#

elkowars wacky widgets

blazing ocean
rough drift
#

I just browse the sub like "woaaaaaaaaaah"

blazing ocean
#

It's awesomewm

rough drift
#

yeah

peak depot
#

rad stop taking those drugs they are not good for your brain

rough drift
#

I don't know if my keyboard can do it

#

probably can since it has some sort of rgb lighting

blazing ocean
#

I've never really tried awesome

#

I guess I should but I don't really have the time currently kek

rough drift
blazing ocean
#

I have that wallpaper on my phone

blazing ocean
sly topaz
blazing ocean
#

unfortunately it's wayland

rough drift
blazing ocean
sly topaz
#

it just takes one gnome program to make everything look out place

deft summit
#

how tf does one build a maven project into a jar without intellijj

#

lol

sly topaz
#

you do need maven installed though

deft summit
#

frick

blazing ocean
#

Or maven wrapper

rough drift
#

I want to take a month of my time someday and just set up a linux install how I like it

deft summit
#

also, side note, is there a way to change my name on spigotmc? lmao

rough drift
#

like get all the looks down yk

undone axleBOT
#

Name changes on the forums are granted to those who have donated to the project. Donations are processed manually and generally take up to 24 hours. The donation widget can be found on the home page of SpigotMC at: https://www.spigotmc.org/.

deft summit
#

dammit -w-

blazing ocean
sly topaz
#

trying to match certain aesthetic I mean

blazing ocean
#

eh it's fun

sly topaz
#

I recommend just making it flexible, not fancy

eternal night
#

spending time setting up visuals when the thing you look at 99% of the time is a webbrowser, discord, intellij and your terminal is crazy

rough drift
#

I don't want to go crazy

blazing ocean
sly topaz
#

jesus the vscode java extension struggles hard with gradle in comparison to maven performance wise lol

rough drift
eternal night
#

web browser is w/e

#

terminal sure

#

and IJ, I just like the default theme

river oracle
rough drift
#

intellij can be customized too, just so you know

eternal night
#

i know

sly topaz
rough drift
#

then gave up for a bit

river oracle
#

ohh

#

full redesign is probably not fun

rough drift
#

yeah

#

it is not

blazing ocean
sly topaz
#

full redesign is pointless, you're going to burn yourself out just by trying to keep up with canary channel lol

eternal night
blazing ocean
#

no

rough drift
river oracle
#

my firefox is super customized

sly topaz
#

it looks like stock firefox

eternal night
#

looks completely stock theme KEKW

blazing ocean
#

it literally isn't

#

oh shit

#

wait

sly topaz
#

no vertical tabs smh

blazing ocean
#

this isn't my usercss

river oracle
#

very custom

blazing ocean
sly topaz
#

vertical tabs πŸ”› πŸ”

#

once you start using them, there's no going back

deft summit
sly topaz
#

why did discord have to make the on top emojis' color so close to the dark theme color

deft summit
#

with maven it works

sly topaz
#

ah, you are wolf

deft summit
#

I am yes

#

I had to verify really quick to be able to upload attachments lmao

sly topaz
#

I thought it was a completely different person, compact mode has betrayed me again

deft summit
#

now why tf does it not work with gradle QwQ

sly topaz
#

have you tried building with clean build instead of just build

#

maybe it isn't pickup up the changed classes at all

deft summit
#

fair, imma try that

blazing ocean
sly topaz
#

why not Zen

#

or Floorp

blazing ocean
#

why not what

sly topaz
#

Firefox forks

rough drift
#

is it a good idea πŸ’€

blazing ocean
sly topaz
#

yes, because edge is the superior browser

#

runs

eternal night
blazing ocean
#

explode

eternal night
#

sometimes I wish I had ban powers on this discord too

blazing ocean
#

why did I just get a gmail notification from 60 days ago πŸ€”

blazing ocean
#

(cancelling those)

eternal night
#

what would even be the point of cancelling a tick oxD

rough drift
blazing ocean
#

and then

#

how is it gonna run on any spigot server

rough drift
#

great question! probably not

rough drift
blazing ocean
rough drift
blazing ocean
#

I mean your "write once, run anywhere" kinda doesn't work when "anywhere" has to be modified to work with your things

eternal night
rough drift
sly topaz
#

-1 for gradle I guess

eternal night
#

1.21.3 starts skipping ticks after 60 seconds without players online

sly topaz
#

well, for the extension rather, this is totally on them lol

eternal night
#

until the first player joins again

blazing ocean
#

just use IJ kek

deft summit
#

Guess I'll swap my entire plugin to use maven instead Β―_(ツ)_/Β―

rough drift
eternal night
#

only relevant version

#

/shrug

rough drift
#

plus what if you want more specific behavior

sly topaz
blazing ocean
rough drift
deft summit
blazing ocean
#

and why not just use IJ

deft summit
#

why must the universe hate me

sly topaz
#

there is an unofficial userdev for maven but idk what the state of that is

blazing ocean
deft summit
#

So essentially, my options now are:
A: I change my entire plugin to use maven instead of gradle, and hope to get the unofficial userdev working
B: I do not change anything, and just restart my server each time I make a change
C: I have to use IntelliJ

rough drift
blazing ocean
deft summit
#

I dont want to xD

blazing ocean
sly topaz
eternal night
#

let the man dream rad damn

rough drift
eternal night
#

no need to be so depressing about it

sly topaz
#

it sounds like torture but if you're willing to go this far to use vscode

rough drift
#

idk rad just likes shooting ideas down πŸ’€

blazing ocean
rough drift
deft summit
eternal night
#

sponge but maintained by one guy ℒ️

rough drift
#

Sponge is a hack at best, mine is a carefully thought out and designed API :P

sly topaz
#

I've really taken a liking to maven honestly, too bad the Paper guys aren't really interested on it

eternal night
blazing ocean
deft summit
eternal night
#

damn, I mean you can be cocky about your ideas but calling sponge trash is out there

deft summit
#

:3

blazing ocean
#

πŸ™

eternal night
#

doubt it

rough drift
sly topaz
#

if anything, it is overengineered

blazing ocean
#

I mean sponge made mixin and configurate

rough drift
#

yeah

eternal night
#

Yea, the API is painful

rough drift
#

I talk from having had to work on Sponge

#

I don't really like it

eternal night
blazing ocean
#

kek

#

and mixin is only really made by one guy

sly topaz
#

they also got massive API version fragmentation issues

exotic citrus
#

Hey guys, how can i use spring with spigot? Someone here has a exemple to share?

sly topaz
#

they got like 5 versions above 8 but everything I've seen around uses api 8 too which is eh

blazing ocean
#

@chrome beacon when πŸ”«

blazing ocean
exotic citrus
#

I wanna use spring data and bean configs

#

What do you recommend?

sly topaz
rough drift
#
final var world = server.worlds().byName("world").orElseThrow();
world.events().register(WorldBlockBreakEvent.class, event -> {

});
```weeeeee world-specific events
eternal night
#

byname KEKW

rough drift
#

well, I mean, there is also byId

eternal night
#

what id

rough drift
#

A UUID

eternal night
#

thats a bukkit thing

blazing ocean
eternal night
#

idk why you'd wanna add that lol

rough drift
#

byId is nice if you want to quickly encode the world and have it be more resistant to users renaming shit

rough drift
blazing ocean
#

bad method name then

rough drift
#

server.worlds().list() gives the entire list

blazing ocean
#

worldManager or sth

rough drift
eternal night
#

I mean, if you are doing a bukkit competitor, maybe don't copy the arguably trash dimension to world split

sly topaz
#

why not just call it Worlds instead of WorldManager

blazing ocean
#

yea

sly topaz
#

I hate Manager suffix, it is so ugh

rough drift
blazing ocean
#

and?

sly topaz
#

why does that matter

rough drift
#

Thought about it then figured that WorldManager would be easier to understand at a glance :P

#

you don't have to double check if it has an s or not

blazing ocean
#

and not a manager

rough drift
#

I mean yes

#

but consider the fact that

#

it's type is not a list

#

you can't really mix up worlds() returning a list, no?

blazing ocean
#

what

rough drift
#

Server worlds list makes sense as a sentence

blazing ocean
#

??

rough drift
#

server worlds by name

sly topaz
#

why not just have WorldManager/Worlds implement Iterable

blazing ocean
#

yea or extend list or some shit

rough drift
eternal night
#

don't extend list

rough drift
#

actually it should be WorldList

#

not WorldManager

#

because PluginList exists

sly topaz
#

call it Plugins and Worlds kek

rough drift
#

yeah but it can get annoying

sly topaz
#

having List in the name kind of implies it is some kind of List implementation

rough drift
#

public void add(Plugins plugin) this can happen and be annoying

blazing ocean
#

you're acting like worlds() returning a manager cannot get annoying kek

sly topaz
#

the plural or the singular ones

blazing ocean
#

singular

rough drift
sly topaz
#

then it isn't an issue

rough drift
blazing ocean
#

I have this a lot with e.g. RegisteredSprite & RegisteredSprites (Registry<RegisteredSprite>) and RegisteredSprite is always first

rough drift
#

instance should be renamed*

sly topaz
#

yeah, that's kind of annoying then

rough drift
#

intellij reccomends familiar types more

blazing ocean
#

I mean no

#

I use both a lot kek

rough drift
#

load UUID searches the world container for a world with that UUID, might remove it

blazing ocean
#

I love how list does not return a list

rough drift
#

list in this case is being used as a verb

blazing ocean
#

why not

rough drift
#

list <stuff>

blazing ocean
rough drift
#

lmao

rough drift
#

I always hated how std lib methods return Collection

eternal night
#

What this is attempting to be is the level key

blazing ocean
#

"folder"!?!?!??! it's directory πŸ€“

eternal night
#

Like minecraft:overworld

rough drift
#

hence "byName"

eternal night
#

So world encompasses all it's dimensions?

rough drift
#

no..

#

oh wait

eternal night
#

yea

#

byName("world") would make 0 sense in vanilla terms.

#

Given there are three levels that are under the "world" level name

#

Using the overworld, the_nether and end keys respectively

shadow night
#

Yep

rough drift
#

yeah I like the split of world vs world_nether and world_end ig, but you did give me an idea

#

hold on lynx you gave me a GREAT idea

#

1s

shadow night
#

It's garbage and makes everything harder

blazing ocean
#

yea

blazing ocean
sly topaz
#

you're such a pessimist rad smh

#

on a side note, please don't use gradle if you are planning to use vscode for java

blazing ocean
sly topaz
#

I used to get it a lot too, mostly due to my skepticism

shadow night
ivory sleet
sly topaz
#

learn to words thing in ways that do not picture me as just some pessimist

sly topaz
sly topaz
shadow night
sly topaz
#

just the gradle integration that it is wonky

blazing ocean
#

gradle is like

#

magic

sly topaz
#

which makes sense, since the extension is just headless eclipse lol

shadow night
#

It's neat

blazing ocean
#

I love their plugin API tbh

#

and the extension API specifically

ivory sleet
glossy laurel
#

Guys, how do I set a player's permission with vault?

blazing ocean
#

player.setPermission?

sly topaz
#

hot reloading doesn't work

rough drift
# shadow night I hate that split
final var world = server.worlds().byId(Identifier.minecraft("world")).orElseThrow();
final var overworld = world.dimension("overworld").orElseThrow();
```Yes?
rough drift
#

each world becomes a container for N dimensions

blazing ocean
#

too much var tho

rough drift
#

yeah ignore that I wanted to type little

shadow night
blazing ocean
rough drift
shadow night
#

But it's still quite long, especially since I'm on mobile

rough drift
#

yeah

blazing ocean
rough drift
blazing ocean
#

better than your ensureWorld thingy or whatever

rough drift
#

I removed all ensure

glossy laurel
rough drift
#

and nullable

#

switched it with optionals

blazing ocean
#

good

glossy laurel
#

Then wtf is the point of vault if vanilla has everythinf

blazing ocean
rough drift
#

PermissionAttachment exists

shadow night
rough drift
#

or resources that are not guaranteed to be there

shadow night
ivory sleet
blazing ocean
#

nah nah getById("MInEc!"Β§raft:ijas!!") exists as a world

rough drift
glossy laurel
#

So how do I set it then

rough drift
#
final var testWorld = server.worlds().create(Identifier.plugin(context.plugin(), "test")).orElseThrow();
```bap
blazing ocean
rough drift
#

world creation!!

glossy laurel
blazing ocean
#

and all the custom world stuff

rough drift
blazing ocean
#

fair

rough drift
chrome beacon
#

Why isn't setCancelled fluent

#

like the getters

rough drift
#

it's easier to understand at a glance if something is a getter, an immediate setter or a deferred setter

#

I'll explain the difference later but yeah it's just a readability thing

chrome beacon
#

Your standard you mean

rough drift
#

yes

chrome beacon
#

It's not "the" standard

#

mixing the two is quite cursed

rough drift
#

yeah I'm writing with one hand, drinking a cup of tea lol

mortal hare
#

shower thought: what was the point to mojang migrating from username authentication to UUID based authentication? We still cant have duplicate usernames in Minecraft?

chrome beacon
#

There are users with duplicate names

mortal hare
#

on bedrock i guess

chrome beacon
#

on Java

mortal hare
#

i havent seen one in java

rough drift
mortal hare
#

as far i aware you cant change it to duplicate one

#

how did they manage to get it?

rough drift
#

you used to be able to have it

#

bugs

chrome beacon
#

They're old

#

before that got fixed

mortal hare
#

so what's the point of UUID's

rough drift
#

in the case of duplicate names

#

and also because someone can change name

chrome beacon
#

^^

rough drift
#

it is more stable to use UUIDs

mortal hare
#

you could also change nicknames before

young knoll
#

Not before uuids

rough drift
#

yes, and it wasn't reliable

#

oh yeah fair

mortal hare
#

it would bring more parity between two versions

rough drift
#

/op duplicatename

mortal hare
#

bring UI to that

chrome beacon
#

Parity is already quite off between the versions

rough drift
mortal hare
#

what's stopping from implementing tags

#

for currently active users on the server

#

if you want to give op to user which is offline just get the uuid

rough drift
#

hm yes

mortal hare
young knoll
#

Can't wait for Bukkit.getOfflinePlayer(name) to return a collection

worldly ingot
#

Duplicate names are just stupid and shouldn't be a thing

#

Even Steam has unique usernames

#

Your display name however does not need to be unique. You can change that to whatever. But every Steam user's username is still unique

#

Java Edition has this. We have player display names

mortal hare
#

we have player display names, usernames and UUID's

#

two of them act as unique identifiers

rough drift
#

why so mad

mortal hare
#

why not just one

#

idk it just sounds kinda lame

worldly ingot
#

Like I said, Steam does the same thing

#

It has a unique username and a unique steam id

rough drift
#

Chat should I make the tick event per world

worldly ingot
#

Technically speaking, Bedrock Edition does have the same system. Your username is unique - it's your Microsoft account name

slender elbow
#

technically speaking, I don't care

worldly ingot
#

Also that

rough drift
#

A server is a context which holds world which are a context which hold dimensions which are a context

#

perfect

mortal hare
#

username is just for convenience, but i dont see why you cant change your display name tho for ./op you could just use username, but with tab completion which maps display names to usernames if the player is active on the server

rough drift
#

perfection

mortal hare
#

UUID's although unique, but has the same problem as IPv6, its too damn verbose to be used widely

limber whale
#

can someone tell me how can i check which version has which nms namespace or whatever it is called?

like certainly i need what versions does v1_21_R2 cover? does it cover 1.21.1 or only 1.21.2?

rough drift
#

depends

#

each version is quirky like that

limber whale
#

yes, is there some website like protocol.vg for protocols

#

to check

rough drift
#

idunno

limber whale
#

which nms name is for which mc version

#

ah

mortal hare
#

in modern versions

mortal hare
#

am i wrong though

#

im pretty sure i've saw that packaging of NMS at around 1.16 was changed no?

young knoll
#

1.17

mortal hare
#

i havent touched spigot in at least a year now, but i think in order to develop against NMS in 1.17+ right now you need to use Bukkit.getBukkitVersion() method to retrieve bukkit api version and then use mojang mappings to develop in NMS and use instantiate specific version of NMS-dependent classes which would be remapped to back to obfuscated ones

mortal hare
#

if in https://wiki.vg/ protocol id list there's multiple id's for the same version, there's certainly a great chance that version has more than one R candidate probs

#

i may be wrong though, as i said i havent touched anything minecraft related long enough for my info to be accurate

uneven marlin
#

Hello, I want to make a custom inventory in my plugin, but I can't add an item inside it. What could be the problem?

My code:

public class TestGUI implements Listener {
    public static Inventory inventory = Bukkit.createInventory(null, 9, "Menu");

    public void CreateGUI() {
        ItemStack item = new ItemStack(Material.POISONOUS_POTATO, 1);
        ItemMeta meta = item.getItemMeta();

        meta.setDisplayName("Potato");
        List<String> lore = new ArrayList<String>();
        lore.add("Unbelievable");
        meta.setLore(lore);
        item.setItemMeta(meta);

        inventory.setItem(4, item);
    }
}
uneven marlin
#

it opens the inventory, but there is no item

spiral light
#

where does it open the inventory ?

uneven marlin
# spiral light where does it open the inventory ?

in a separate class:

public class OpenTestGUICommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
        Player player = (Player) commandSender;

        player.openInventory(TestGUI.inventory);

        return true;
    }
}
sly topaz
#

you don't call CreateGUI anywhere

spiral light
#

and when do you call the createGui =

sly topaz
#

also, please use lowerCamelCase for method names

#

ideally, you'd just make it the constructor

#

?guis

undone axleBOT
timid berry
#

basically i have a method called generate hit

#

which will take a players data i will give and do something with it

#

but idk how to access it without errors

spiral light
#

give the variable a type ?

uneven marlin
timid berry
#

oh like this?

spiral light
#

yes. thats java basics

timid berry
#

im trying to look through all the players online n check if they are sutible but it seems it only detects player "zar1f" and not also "Zarif"

#

the print system is for debugging

#

and it only prints zar1f

#

never Zarif

pseudo hazel
#

maybe because you return in the middle of the for loop?

timid berry
spiral light
#

after the loop

pseudo hazel
#

after its done

#

idk what the goal is xD

timid berry
#

to loop through all the players, find one that isnt you

pseudo hazel
#

if you need to look through all players that are online then dont return

timid berry
#

or just not return

pseudo hazel
#

your formatting looks really weird

timid berry
#

it fr be

pseudo hazel
#

so weird even that its the cause of your errors

#

like when should the No players found message appear

timid berry
#

it should appear when the it loops through all the players and none of them meet my conditions

pseudo hazel
#

okay

timid berry
#

does it do that?

pseudo hazel
#

well right now its gonna print regardless after the if check

timid berry
#

oh no it does that for all of them

pseudo hazel
#

fix your formatting first

#

to the compiler it doesnt matter but to whoever is reading it, they will interpret it wrongly, including yourself

#

whitespace is not important in java like it is for python

#

you have to use brackets explicitly

lilac dagger
timid berry
pseudo hazel
#

a what

timid berry
#

alr done that

lilac dagger
#

oof lol

timid berry
#

where should i put my no players found?

pure dagger
#

you need to learn java basics

timid berry
#

true

lilac dagger
#

yeah you don't need this whole loop by the looks of it

pure dagger
#

maybe before loop make
boolean found = false;

in the loop if a player is found then
found = true;

after loop check if it was found or not

#

or not

#

because you return

blazing ocean
#

just check if the list is empty

lilac dagger
#

nvm

pure dagger
#

there is no list

#

you can just print no players found after the loop, because if a player is found ,you return, so it will only get to the code after loop if you dont return = if you dont find any plaer

blazing ocean
#

the online player list

timid berry
#

should i ignore this?

pure dagger
#

but why would he check if its empty

#

he wants a player which is not the player given

#

so list should be probably empty or 1 element hwich is the player

blazing ocean
#

oh right there are further checks

#

yea okay then

pure dagger
timid berry
#

i know

#

after the loop im checking if its found

#

but it says found is always false

#

even tho i set it as true

pure dagger
#

as i said, if you get to the place after the loop, it means you havent found any player so you havent returned

pure dagger
timid berry
#

print what after the loop?

#

that none found?

pure dagger
#

ye

timid berry
#

my grandmas crying in the other room

pure dagger
#

why

timid berry
#

she wants to go back home (flight is months away) and the days arent passing by

pure dagger
#

i dont get it but i guess good luck

timid berry
#

it so works

#

yippee

remote swallow
#

that code just hurts

timid berry
#

how

#

its good enough

#

theoertically it would get the same person everytime right?

chrome beacon
remote swallow
#

i dont see a reason for it to be static, its not named correctly and i dont think ur checking its the right player how you want

pure dagger
#

yeah, name it generateHit not generatehit because you start with lowercase, then another word starts with uppercase letter, also instead of doing .toLowerCase() on two strings, just use string1.equalsIgnoreCase(string2); this method already ignores the case

#

also

#

you placed the "!" adter "is" not after p.getName()

remote swallow
#

that is the correct place for the !

#

or if ur talking about the message doesnt really matter

pure dagger
#

yeah message

timid berry
#

is there a way to randomize the players?

#

like i know if thers 3 sutible people

#

theres one person thats always gonna get picked

pure dagger
#

also you dont need the extra braces in if statement,
instead of
(condition) && (condition)
it can just be
condition && condition

thats becasue there are 2 booleans with only one AND operator, if there would be more operators and you would want to change the order, which one will be first, then you add braces

timid berry
#

right?

#

because they will be first in the p list?

pure dagger
#

wait a second

remote swallow
#

dont choose the first person then

timid berry
#

i mean

#

i want to randomize

pure dagger
#

idk

timid berry
#

who i choose

#

I guess ill store the sutible players in something then randomly pick them?

remote swallow
#

figure out who is a valid option to pick and choose a random element

pure dagger
#

i dont know the best way to do it, but you should read what i have just written, and understand it

pure dagger
echo basalt
#

getClass and compare

pure dagger
#

okay

timid berry
#

wait

#

so i gotta create a new array

#

everytime i wanna add something to it?

pure dagger
#

i mean arrays have set length which you cant change

#

but you can use arraylists

#

but you should know that, if you don't its gonna hard to make a plugin probably

#

but

timid berry
#

na its okay

#

i will create hypixel but make it pay 2 win then retire in kosovo

#

/j

pure dagger
#

i started programming because i tried to make plugins for minecraft, but i didnt understand a thing so i started learning java later

echo basalt
#

I learned java as I made plugins

timid berry
#

^

#

me

echo basalt
#

but I had existing principles

timid berry
#

i know other languages

echo basalt
#

and had been coding in other languages for a while

timid berry
#

so i know how arrays and stuff works

echo basalt
#

and by other languages I don't mean html

pure dagger
#

xD

timid berry
#

i have practiced

pure dagger
#

scratch

echo basalt
#

and I wasn't making a clown of myself

timid berry
#

c++, python and javascript

pure dagger
timid berry
#

not to a professional level

#

but a basic

#

one

echo basalt
pure dagger
#

why

#

why so rude

echo basalt
#

he's been refusing to learn and just brute forced it

pure dagger
#

idk

pure dagger
echo basalt
#

you trolling rn?

remote swallow
#

i love static aboos

pure dagger
#

no i just dont understand

echo basalt
#

Cool so let's cover it briefly

blazing ocean
#

Is there any way to get the jarfile of a plugin, or of all active plugins on the server? doing some scripting fuckery (Kotlin, not any other bad shit kek) and would like to add all active plugins to the classpath

echo basalt
#

When you're self-taught you end up facing every bad habit imaginable because it's the shortest route

echo basalt
blazing ocean
#

fuck

pure dagger
#

okay but does it make a difference in small plugin?

echo basalt
echo basalt
pure dagger
remote swallow
#

hey illusion whats this

echo basalt
#

just a thought

echo basalt
#

no, it's not efficient

#

it's dogshit

blazing ocean
echo basalt
#

just cache the method and move on

remote swallow
#

method handle wooo

pure dagger
#

or what

echo basalt
#

✨ it depends ✨

pure dagger
#

yeah,,

echo basalt
#

9/10 cases just make an object

#

(especially if you're writing in kotlin)

remote swallow
remote swallow
echo basalt
#

primary language at work

#

and I might be using it at a diff company if I pass the interview process

worthy yarrow
#

Static access isn’t bad per se, however like illusion said it depends, it’s hard as a beginner to understand what qualifies an object or a field to be static

remote swallow
#

compiled objects have static fields but singletron'd methods

timid berry
#

why will playersthatcan.size() always be zero?

echo basalt
#

Static access is for a somewhat niche use-case but most ppl abuse it because "how do I pass an object"

pure dagger
echo basalt
#

I'll leave this here

#

I'll also suggest using equalsIgnoreCase and seeing if your if statement goes through

#

And using UUIDs instead of names

pure dagger
#

and do
List<String> playersThatCan = new ArrayList<>();
not array list 2 times, and also no "String" 2 times

echo basalt
#

but wtev he isn't here to listen

remote swallow
#

just gonna

#

?learnjava!

undone axleBOT
timid berry
#

dis is like

blazing ocean
glossy laurel
#

why is my key randomly red

echo basalt
#

why don't you just use an init block

blazing ocean
#

fuck I am dumb

echo basalt
#

or inline the variable because kotlin lets you

remote swallow
#

rad what the fuck is that

echo basalt
#

also there's a minor issue if I decide to delete my .jar at runtime

remote swallow
echo basalt
#

to, for example, reupload a new version

#

but you'll figure that out

blazing ocean
#

don't run scripts and delete jars fr

glossy laurel
#

I moved Vault dependency lower down in my dependency list and it fixed it

#

no comment

timid berry
#

going to get ur oil changed and the mechanic starts talkin about some wind shield wipers

echo basalt
#

oh yeah doesn't vault have some transitive dependency for 1.13

remote swallow
#

no im pretty sure TrimPattern implements Keyed

echo basalt
glossy laurel
remote swallow
#

which uses get key

glossy laurel
echo basalt
#

paper moment iirc

remote swallow
#

you sure ur on spigot kekw

timid berry
#

ngl sometimes i actually dont know

glossy laurel
#

shit

#

?whereami

pseudo hazel
#

you outed yourself lets go

glossy laurel
blazing ocean
#

is there a server classloader

#

and is it just under the mcserver class or sth

echo basalt
#

uh

timid berry
#

i have a feelling that playersThatCan.size() will still return 0

remote swallow
#

still dont like it but it looks fine

echo basalt
# timid berry ngl sometimes i actually dont know

Cool so let's break it down: When someone gives you good quality advice you should listen. Being ignorant because it doesn't fix your immediate issue is not gonna work long-term. There's a reason why me and countless other people wrote guides

sonic goblet
pure dagger
#

why there is _ in name

echo basalt
#

python

pure dagger
#

BUT ITS NOT PYTHON!!!!!!

echo basalt
#

so?

timid berry
#

it works

pure dagger
#

and still there is no equalsIgnoreCase() πŸ˜” i give up

remote swallow
#

?spoon fr

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

echo basalt
#

I'm surprised you lasted this long

timid berry
#

will it make a performance difference?

pseudo hazel
#

are you ever gonna touch this plugin again in the future?

pure dagger
#

dont know but its looks bad

timid berry
#

is this it

river oracle
pseudo hazel
#

programming is not always about performance

pure dagger
#

you can remove the braces

echo basalt
remote swallow
#

he has a gf i think

blazing ocean
echo basalt
#

he doesn't belong here

pseudo hazel
#

thats what she woulvde said

pure dagger
#

hey im a devv and i am a girlfriend

sonic goblet
blazing ocean
#

shioku does too

echo basalt
#

from what I've seen you advocate for static abuse so you're not a dev

remote swallow
#

choco has a husband

echo basalt
#

at least not a respectable one

remote swallow
#

so does simple

pure dagger
pseudo hazel
#

no because its Player objects

pure dagger
#

yeah right

echo basalt
#

solid chance yeah but is it really good practice to store players in a list?

echo basalt
pseudo hazel
#

well yeah in this case it works

#

but its terrible practise

echo basalt
#

bukkit doesn't do throwaway entities

pure dagger
#

so you could have 2 player objects "from 1 player" but one could be changed? or im not right

pseudo hazel
#

thats an implementation detail i feel like

echo basalt
pseudo hazel
#

no i think there is only 1 player object per player

#

yeah or that

echo basalt
#

player object is tied to the player's lifecycle so if you keep it beyond that it's your problem

pure dagger
#

can you clone it 😺

blazing ocean
timid berry
#

is an arraylist with nothing in it size 0? or null

echo basalt
pseudo hazel
#

size 0

echo basalt
#

it's an empty list

timid berry
#

so if i add one player to it

blazing ocean
pure dagger
#

idk how to clone player objecet

pseudo hazel
#

if you add 1 player to it, the size will be 1...

#

thats basic calculus

pure dagger
pure dagger
echo basalt
#

(it's not both of y'all just refuse to learn it)

pseudo hazel
#

imagine though

#

nullable constructors

pure dagger
#

m

blazing ocean
#

(as it should)

echo basalt
blazing ocean
#

leaking this type shit

pure dagger
#

i know that ArrayList constructor returns not null

#

it returns arraylist

pseudo hazel
#

well yeah

echo basalt
#
public interface MyObjectProvider {

  MyObject provide(MyParam one, MyParam two);

}
pseudo hazel
#

luckily

echo basalt
#

or a static factory method

#

hm

pseudo hazel
#

right

#

but thats not a real constructor

#

noone would be confused by that

echo basalt
#

Lists.newArrayList type shit

pseudo hazel
#

yeah thats an L way to do it

timid berry
#

my code feels messy as hell

echo basalt
#

go figure

pure dagger
#

if its yellow

#

it means something

blazing ocean
#

interesting

echo basalt
#

bet 5 bucks it has some library dependency it isn't loading

timid berry
#

nvm it errors in the logs

blazing ocean
#

hmm

#

the stdlib should be in the classpath right

timid berry
pure dagger
#

maybe it says something like "list is always empty"

blazing ocean
#

wait it probably isn't by default

blazing ocean
sonic goblet
timid berry
#

purpurp

pure dagger
#

u shouldnt do -1

timid berry
#

yah but if thers 4 players

#

and i want it to access the 4th

#

i would do 4-1

pure dagger
#

Random.nextInt(4) is 0 or 1 or 2 or 3, no need to subtract

echo basalt
#

I'm surprised java doesn't have a CollectionUtils.getRandom type thing

pseudo hazel
#

yeah same

remote swallow
#

kotlin πŸ’ͺ

pseudo hazel
#

I was wondering about that too

echo basalt
#

randomOrNull πŸ’ͺ

#

I do have a java equivalent

timid berry
#

i think i see the error

blazing ocean
#

CollectionsKt my beloved

pseudo hazel
#

dont subtract 1

pure dagger
pseudo hazel
#

literally read what we say

#

and you would be rich

timid berry
blazing ocean
remote swallow
#

not 1-4

pure dagger
#

if its 2

timid berry
#

yes

pure dagger
#

random will return 0 or 1

timid berry
#

i understand it now

echo basalt
#

what's the confusion about generating a random number

remote swallow
pure dagger
#

if its 0, then you cant put 0 into nextInt() method

pure dagger
#

hah

blazing ocean
echo basalt
#

can we rephrase that as "if the list is empty there's nothing to get"

pure dagger
echo basalt
#

let him figure that out instead of just spoonfeeding

pure dagger
#

idk

echo basalt
#

he wants to figure it out

#

that's the reason he ain't reading

#

so don't pretend he doesn't

pure dagger
#

xd

#

yeah, you should start reading

#

zahin

timid berry
#

i think this will work

echo basalt
#

I don't

pure dagger
#

do you check why its yellow?

#

if you dont you should

timid berry
#

its not true

pure dagger
#

if it says so

echo basalt
#

it literally is

pure dagger
#

it probably is

#

i mena ide's are not 100% right but in this case it probably is

pseudo hazel
#

the size is always gonna be 1 xD

#

it definitely is right

pure dagger
#

OH

#

because hes returnin

#

no..

pseudo hazel
#

?

#

no..

pure dagger
#

wait i need to see the code im lagging

#

sorry

timid berry
#

it works

#

i think

#

lemme get another alt on

pure dagger
#

why is it alwways size 1?

timid berry
#

it isnt

pseudo hazel
#

if size > 1 ? ----> else if size > 0 ? , if it gets there, the size must be between 1 and 1

pure dagger
#

oh.. okay..

timid berry
pure dagger
#

didnt even see that if else if

sonic goblet
pure dagger
#

yeah

#

in the if else, you could as well just check if size == 1

timid berry
#

u right

torn badge
#

You don't even need the else if

timid berry
#

i do

pure dagger
#

no, just check if its bigger than 0

torn badge
#

!isEmpty()

echo basalt
#

you can also rewrite the entire method

pure dagger
#

right, ur gonna be generating random number between from 0 to 0, but yeah

timid berry
#

Theoretically can i access the target variable from the main file?