#help-development

1 messages Β· Page 2138 of 1

tender shard
#

why can't intellij decompile everything and then let me check ALL usages / allow Ctrl+Shift+F

worldly owl
#

ah intellij, the pro java programmers ide

tender shard
#

I wanted to write a plugin to allow this but I already died at the basic things. IntelliJ plugins are way too complicated lol

ivory sleet
#

works fine for me mfnalex

#

or well I am in a mod env now

#

but ye

tender shard
#

ServerPlayer*

worldly owl
#

speaking of NMS: why do you have to use nms for some stuff? surely that could just be built into the bukkit api right

tender shard
#

after all, spigot is made by volunteers, so not EVERYTHING is included there

worldly owl
#

makes sense

river oracle
#

I don't get how bukkit API works do they have to recode for all the new nms methods each version

ivory sleet
#

alex

worldly owl
#

i was just curious

river oracle
#

because I know a lot of stuff can break

ivory sleet
#

but ye in a mod env

tender shard
ivory sleet
#

so it adds the mojmaps as a source file

river oracle
tender shard
# ivory sleet

hm yeah but... I want to see all USAGES of GameProfile

ivory sleet
#

okay

#

the list continues :3

vestal dome
tender shard
#

@ivory sleet look at this pls:

worldly ingot
vestal dome
#

(it's too much time wasted mapping everything)

tender shard
worldly owl
#

AAH FLASHBANG

tender shard
#

in my plugin, I can just do Ctrl+B and it shows me all usages of that field in all classes. But in a decompiled class (Villager), I mark the "WANTED_ITEMS" fields and do Ctrl+B. It tells me there are NO usages at all, but obviously it's even used in the same class

ivory sleet
#

hmm

#

what if you "Choose sources"

tender shard
#

and that sucks. it should at least find usages in the same decompiled class

river oracle
# ivory sleet hmm

#general idk the answer to this question its too complex for my brainn

echo basalt
#

you can not possibly be serious

vestal dome
tender shard
river oracle
tender shard
echo basalt
tender shard
#

I think at least my fckn expensive ultimate version should be able to do this

echo basalt
#

nms would be so easy if middle-clicking a method actually took you to its definition

tender shard
#

the "find usages" is the thing that's not working

#

for me

worldly owl
#

so theoretically if i were to make this rank plugin would i need vault intergration for the prefixs?

echo basalt
#

I middle-click EntityInsentient's G() and it takes me to EntityLiving's e() for no reason

tender shard
#

with mojang mappings, that works totally fine for me

echo basalt
#

makes it too easy

ivory sleet
#

alex look at my cursor

#

fuck it doesnt even copy the cursor

#

wait let me edit the photo

echo basalt
#

that's hella easy wtf

ivory sleet
#

I use Windows + print screen cuz ye

tender shard
echo basalt
#

imagine knowing what you're referencing when coding 🀑

tender shard
#

but erm

#

Spigot doesn't have any sources anyway

#

only spigot api has it

#

Sources not found for: org.spigotmcspigot1.17.1-R0.1-SNAPSHOT

echo basalt
#

import both

tender shard
#

that doesn't help

#

it still won't have sources for spigot itself

#

since there are no public sources for this

#

only thing I could imagine that'd work is to manually "mvn install" the thing that buildtools creates

#

but still that doesn't create any sources .jar

#

mojang definitely likes verbose variable names lol

#

I would have simply used "GOLEM_GOSSIP_DISTANCE" instead of HOW_FAR_AWAY_TO_TALK_TO_OTHER_VILLAGERS_ABOUT_GOLEMS lol

ivory sleet
#

yeah, well they take all enterprise and object oriented conventions, principle and patterns dead serious

#

had a singleton for sneaky throws

vestal dome
#

eh I like it

#

when they add something into Minecraft, or change something

#

they keep it that way..

#

which is good

ivory sleet
#

@tender shard btw have you tried with sth like paperweight?

worldly owl
#

Hey are there any good docs for the mongo java api? the official spigot ones are outdated.

ivory sleet
#

there are some up-to-date yt tutorials

tender shard
worldly owl
tender shard
#

youtube tutorials >.<

#

am I the only one who prefers written tutorials? πŸ˜„

#

youtube videos are so long and you can't Ctrl+F

ivory sleet
#

I do prefer textual ones

#

but yeah

tender shard
#

and they always have a 5 minutes intro like "yo guys wassup today I went up and had a shower and ate a loaf of bread" and only after 5 minutes do they even start to talk about the topic

#

a few years ago I wanted to get into iOS development and that dude was literally reading all the XCode reviews on the apple app store for like 10 minutes instead of simply saying "Okay, download XCode and then let's go" o0

vestal dome
#

how to get every Event in bukkit

ivory sleet
#

a bit hard

worldly owl
ivory sleet
#

since classes load and unload dynamically

vestal dome
#

ok then I have an easier question

#

Imagine a Class has static variables.

#

how can I make the class set the static variables.

#

probably hard to understand..

#

basically in an Event you have a HandlerList.

ivory sleet
#

yup

#

or well

#

not in Event

vestal dome
#

and I want to ask how can I make that HandlerList get set.

#

you understand what I mean

#

in the event class.

ivory sleet
#

get set?

vestal dome
#

yes.

ivory sleet
#

there must only exist a single handler list per callable event class

vestal dome
#

like get the set value.

#

yeah but like

#

If you have

#

PlayerLoadEvent

ivory sleet
#

yuh

vestal dome
#

you have a HandlerList in it.

ivory sleet
#

yeah

vestal dome
#

and the event has not been called ONCE.

#

so the HandlerList inside it, is not yet created.

#

the question is how can I make it create the HandlerList, being HandlerList a static variable.

ivory sleet
#

well

#

write sth like PlayerLoadEvent.class.method() would trigger the static initialization

#

if it hasnt been triggered already

vestal dome
#

oh yeah the static method to get the handler list!

#

good idea.

ivory sleet
#

yeah

#

that for instance

abstract sleet
vestal dome
#

that's the point

#

there's also a static method

#

πŸ™‚

abstract sleet
#

you can do a static method as well yeha

ivory sleet
#

lachlan the problem is that, if lets say PlayerQuitEvent has yet not been called, then that class remains dormant (not loaded) thus its HandlerList instance does yet not exist

trim surge
#

Conclure how could you not know it was me πŸ˜‚πŸ˜­

ivory sleet
#

Jadss merely wanted to eagerly ensure the existence of the HandlerList instance

vestal dome
#

yes because the first event

abstract sleet
vestal dome
#

that is called is absolutely ignored

ivory sleet
#

lachlan well

#

all variables are linked dynamically during runtime

#

hence why its possible to split our systems up into different jar files

#

and dynamically load them

ivory sleet
vestal dome
#

hmmmmmmmmmmmmmmmm

trim surge
#

We have Dms lmao

abstract sleet
#

Jads what are you trying to achieve with this btw?

vestal dome
#

basically log every event.

#

that I care.

abstract sleet
#

wouldn't you want to just create a listener class with an event handler for each?

vestal dome
#

no

#

it's too boring

#

πŸ˜‚

abstract sleet
#

Β―_(ツ)_/Β―

eternal oxide
#

Someone here last week wrote a Listener using generics that was able to listen to multple events (by accident)

#

I forget who

#

Jet something

vestal dome
#

hmm

ivory sleet
#

wait

#

fr

vestal dome
#

maybe it was a "Jad" man, get it?

crisp forum
#

I dont like things like null pointers, narrow range of methods in Java and I use Kotlin for plugin development but I dont know is it a problem to use kotlin in big plugin projects. Is there anyone who is using kotlin for big plugin's development? Would you suggest using Kotlin?

ivory sleet
#

thought the implementation would catch generic event observations

abstract sleet
tender shard
#

certain event classes simply are not "listenable" since they don't have any handlers assigned, e.g. InventoryEvent

abstract sleet
eternal oxide
#

His was a Listener using generics so it only fired on listenable events

ivory sleet
#

sounds weird

#

Ive tried with a generics approach w/ EventExecutor

#

but that still doesnt work

eternal oxide
#

Work for me? Never happened

ivory sleet
#

lets not publicly shame like this

eternal oxide
ivory sleet
#

ugh

#

if that was just possible

trim surge
#

My bad. Wrong dude

#

Deleted messages

#

I need to sleep

ivory sleet
#

ye ElgarL here is just one of the cool developers here

eternal oxide
#

sec I'll see if I can find it

tender shard
#

if someone has any problems with anyone, you can just blame me instead, I'm used to it for using light mode

trim surge
#

πŸ˜‚πŸ˜­

vestal dome
#

what is the hardest thing to make in mc?

ivory sleet
#

imo messing with packets

#

goals was hard

vestal dome
#

hmmm...

#

yeah I'm going to hell.

ivory sleet
#

but became significantly easier with goal navigation and move control

eternal oxide
ivory sleet
#

world generation also has its abstractions nowadays

eternal oxide
vestal dome
#

well I do packets to give good functionality to bukkit

ivory sleet
#

ah elgar

vestal dome
#

since I'm assured bukkit won't give some stuff to developers, like signs to write text.

eternal oxide
#

I was talking with him for a while abotu the type erasure issue.

ivory sleet
#

altho wouldnt T be erased to whatever type Class<T> has

eternal oxide
#

yes

#

However as Jadss is looking for a generic listener that can capture ALL fired events

ivory sleet
#

ah yeah

eternal oxide
#

type erasure is perfect for him

ivory sleet
#

yeah

#

well I know someone who did this with unsafe and shit

vestal dome
#

I already have one tho..

#

like this

ivory sleet
#

but idk if jadss is prepared to take those heights into consideration

vestal dome
#

I am

eternal oxide
vestal dome
#

I say.

vestal dome
#

this system I did still kinda fails due to some events not being loaded..

eternal oxide
vestal dome
#

as previously said.

ivory sleet
#

yeah jadss

#

so youd have to do some really bizarre shit using ClassLoaders and whatnot

vestal dome
eternal oxide
#

Up to you. All Jets code is lined above the link I gave.

#

Yes, you'd have to do every priority.

eternal oxide
#

erasure is only on the Class<T>

torn prawn
#

How can I do a bungeecord proxy where eu players have good ping?

abstract sleet
torn prawn
#

Like, I bought a 2nd bungeecord proxy for eu players, as the main one are good with usa players

torn prawn
#

Every server its in usa

#

i want good ping in usa and eu

abstract sleet
#

hosting provider will sell servers in certain datacentres

vestal dome
#

network not fast enough to make ping good.

#

well

#

I mean the connections

#

ofc

crisp forum
torn prawn
#

So i really cant?

abstract sleet
#

build an island in between usa and eu, hook it up with an undersea fibre optic connection, build a datacentre, you're set 😎

ivory sleet
#

but gradle is superior imho

eternal oxide
abstract sleet
#

I tried gradle and couldn't stand using it, it is definitely superior but I just prefer maven for my projects which don't require gradle's complexity.

trim surge
#

Conclure.. You still gotta teach me generics lmao

ivory sleet
#

honestly, most people make it sound like gradle is complex, which it isnt if you just boil down whats necessary to write

trim surge
#

<T> this shit

ivory sleet
#

Oh

#

yeah

#

I mean classes are types

trim surge
#

And annotations

#

Tmr?

ivory sleet
#

but a class with a generic parameter "<T>" is a type constructor

#

yeah

trim surge
#

Alrighty

ivory sleet
#

basically object orientation but on type level

trim surge
#

Confusion

ivory sleet
#

:c

vestal dome
#

I want to ask question

#

when you do

#

Class.class, does it create a new instance of a Class<?> or not?

ivory sleet
#

nope

vestal dome
#

huh

ivory sleet
#

Class.class is a singleton

vestal dome
#

so I could do cls == eventClass (being cls the same instance as eventClass)

ivory sleet
#

it returns the Class instance that was created during class loading for that very class

eternal oxide
#

its a reference to the class available from the ClassLoader

vestal dome
#

and it's gonna be true?

ivory sleet
#

yes

vestal dome
#

oke good.

ivory sleet
#

remember, singletons (and sometimes multitons) must always be identifiable and comparable with ==

#

this is why enum constants are comparable using ==

vestal dome
#

didn't know class was singleton

ivory sleet
#

yeah

vestal dome
#

I'm also singleton.

ivory sleet
#

lol

#

Ig

vestal dome
#

πŸ˜‚

#

terrible joke

ivory sleet
#

thats true tho :3

crisp forum
vestal dome
#

but not worth

crude estuary
#

Gradle is so Good, it makes my Compiling go πŸš€

vestal dome
#

well list me an advantage of Gradle over Maven.

crude estuary
#

Gradle avoids work by tracking input and output of tasks and only running what is necessary

#

it's Faster

#

by Default

abstract sleet
tender shard
#

I love generics

dusk flicker
#

Fast enough PC and build time isn't an issue

tender shard
#

mvn -T 8 package ftw

#

btw does someone know a java library to parse arguments similar to bash's getopts? e.g.

somecommand --title "some title" --description "some description" --field "title1" "description 1" --field "title2" "description 2" etc
#

should create a map similar to
title -> "some title"
description -> "some description"
fields ->
field1 -> "title1", "description 1"
field2 -> ...

vestal dome
#

when are the issues about bungeecord on github gonna get solved?

dusk flicker
#

we dont control those

#

so could be years

vestal dome
#

tell me otherwise

#

please.

dusk flicker
#

fix it yourself Β―_(ツ)_/Β―

vestal dome
#

too bored.

#

no seriously.

worldly ingot
#

It depends. If the issue has reproduction steps, environment specifics, useful information about the code that may be causing it, and a proposed solution, things tend to get solved quicker

worldly ingot
#

Though generally speaking, in an open sourced project, the burden should lay primarily on contributors

vestal dome
#

well,

worldly ingot
#

Not maintainers

vestal dome
#

well I just needed a flag to remove JLine sad

#

*cries to sleep

worldly ingot
#

and if you've submitted that as a feature requested on GitHub issues, then it's likely been taken notice

#

Not much else to do there unless you intend on adding it yourself and creating a PR

vestal dome
#

I really don't know how it is done..

#

I just feel really sad that it wasn't added to bungeecord, and spigot has that functionality with the flag "-nojline"

#

I really don't even know how to create Pull Requests (like seriously)

worldly ingot
#

Just two different projects with two different purposes and implementations is all

vestal dome
#

else I would probably try it.

#

well... I guess you're right

#

still sad..

#

oh well

#

choco

#

how to do pull request.

echo basalt
#

Create a fork, commit on that fork

#

and then create a pull request from your fork -> master

vestal dome
#

What

#

no you gotta be wrong?

#

there's no way???????

tender shard
#

seems like I'm using the word hologram too often lol

worldly ingot
#

It's at that point you create a section

#
hologram:
  text: ""
  protected_text: ""
  # etc.```
#

If you already have a public release with those config values though, you can fallback to them as well for legacy support

String text = config.getString("hologram.text", config.getString("hologram-text", "your default value"));
String protectedText = config.getString("hologram.protected_text", config.getString("hologram-protected-text", "your default value"));```
quaint mantle
#

oh yeah thats cool

worldly ingot
#

I'm not sure people realize that you can use another config get as a default lol

golden turret
#

im loading a Location from a config

#

using the ConfigurationSerializable of the Location

#

and i have a custom world there

#

how can i make the plugin load the world before deserializing the location in order to it not throw an exception?

#

or is there a class that implements ConfigurationSection which does not deserialize things inside the yaml?

eternal oxide
#

don't access the config until onEnable runs as worlds will be loaded by then

#

make sure yoru custom worlds are loaded too

tender shard
#

because of the config updater, which I needed before spigot finally added the "keep comments" thingy

#

and it's quite hard to get change the config layout later on

boreal sparrow
#

I have a bungycoord network, I host it on one pc (so it's like (publicip): 25565 (lobby)
(publicip): 25575 (minigame) etc.)

Do i need to port forward/ open every port I use, or only 25565?

compact haven
#

only 25565

#

unless you want them to be able to directly connect to bungeed servers

#

otherwise, bungee proxies the connection on the local network

sinful tundra
#

Hey, I need help, I use maven build and i've set the output directory to be a custom one, there I always get two files, the original and the shaded one. Any way I could avoid it and output to my custom directory only one of them?

jovial summit
#

im trying to remake hypixel skyblock using spigot and mongo and im currently at the stage of adding cross-server support for profiles but when i do uuid.toString() (the uuid being the profile uuid, not the player) it returns a null pointer exception. how can i fix this issue because its really annoying and its really making it so i cant make any progress

earnest forum
#

are you using the UUID class or a different one?

jovial summit
#

im using the uuid class

earnest forum
#

is your UUID null?

jovial summit
#

yeah

#

but it cant be

earnest forum
#

how are you getting the UUID?

jovial summit
#

because i dont have anywhere in my code where it doesnt set the uuid

jovial summit
earnest forum
#

show the code

jovial summit
#
  public void initialize(Player player, UUID profile) {
        MongoCollection<Document> collection = getPlayerData(SkyBlock.getMongoClient());
        try {
            ArrayList<String> profiles = new ArrayList<>();
            profiles.add(profile.toString());
            collection.insertOne(new Document()
                    .append("_id", new ObjectId())
                    .append("uuid", player.getUniqueId().toString())
                    .append("name", player.getName())
                    .append("rank", Rank.DEFAULT.name())
                    .append("selectedprofile", profile.toString())
                    .append("profiles", profiles)
                    .append("gems", 0)
                    .append("firstlogin", dateTimeFormatter.format(localDateTime))
                    .append("lastlogin", dateTimeFormatter.format(localDateTime))
            );
        } catch (MongoException e) { e.printStackTrace(); }
    }```
earnest forum
#

?paste

undone axleBOT
earnest forum
#

use this please I'm on phone

jovial summit
#

alr

earnest forum
#

the lines are weird

jovial summit
earnest forum
#

so this method is where the error is happening

#

when you are adding the info

jovial summit
#

its where is says skyblock.getplayerdatabase.initialize

earnest forum
#

what if the player has no selected profile

jovial summit
#

thats literally not possible

#

here

#

ill show you

earnest forum
#

is it defaulted on join?

jovial summit
#

yeah

#

oop

#

here

#

its literally not possible for selected profile to be null

earnest forum
#

do you wanna run a debug check?

#

maybe there's something going on with the loading

#

check if the selected profile is null

jovial summit
#

if (user.getSelectedProfile() == null) player.sendMessage("selected profile is null");

#

added that

#

and got nothing

#

its not the profile

earnest forum
#

do you know if the UUID is null ?

lunar vine
#

okay so the lockettex isnt working i do the sign and it says you must have 500.... 500 what?

#

any idea

sharp flare
lunar vine
#

i typed it in the other channel

lost matrix
#

Same goes for LocalDate

#

And you dont want to manually add "_id" because it will throw an exception

#

The _id fields should be used in the filter instead.
And you should not separate initialization and insertion.
There is something called upsert = update if present, else insert

#

*And use the players uuid as _id. Thus field ist already indexed for faster queries.

dark arrow
#

I have imported the NMS package but i am unable to use EntityPlayer

earnest forum
#

it can be called server player

#

depending what mapping u use

dark arrow
#

But i want t ouswe for Wother Entties

#

i use mojang remmaped

earnest forum
#

ServerPlayer is EntityPlayer but different name

dark arrow
#

So how can i get Different names of other entities?

harsh totem
#

can I put return in a switch instead of break?
I want the function to end in some case

earnest forum
#

yes

harsh totem
#

ok

earnest forum
#

u can put return anywhere in a function

hybrid spoke
#

i would still go with the break

#

and assign a var which you return in the end instead

summer scroll
opal juniper
#

it’s an enum iirc

#

yah

summer scroll
#

I know, but why it requires that parameter

opal juniper
#

so it can get the relative block, idk

lost matrix
earnest forum
#

bottom of like everything

#

except maybe moss

trail oriole
#

I just switch my plugin from a java project to a maven project/file/something, where should I put the config.yml file ?

#

because they're not using maven on tutorials

quiet ice
#

src/main/resources

#

At least by default, depending on your pom it May be in a different place

#

Also, I recommending Reading the Guide for Bukkit over on the Bukkit fandom Wiki, it is incredibly outdated, but the maven concepts have Not changed much since then and I corrected what has changed

grand perch
#

whats the slots for the border in the 9x6 inventory

#

like

#

ive been struggling for like 6000000 hours

quiet ice
#

Border as in what?

grand perch
#

like

#

the edges

earnest forum
#

pixel?

grand perch
#

wat

quiet ice
#

Any Multiple of 9 (including 0) and any multiple of 9 (including 0) plus 8

earnest forum
#

wdym border

#

ah

#

nvm

quiet ice
#

Additionally any Index between 0 and 9 and 9*5 to 9*6-1

grand perch
#

wat

earnest forum
#

45 -53

quiet ice
#

It is that easy yes

grand perch
#

i dont understand

earnest forum
#

for the left and right

earnest forum
grand perch
#

do you even know what i mean

earnest forum
#

yes

#

the edge slots

#

around

quiet ice
#

Yes

earnest forum
#

to make like a hollow square

grand perch
#

yes

quiet ice
#

Exactly

#

Unless you mean the actual Border, which is -1

earnest forum
#

check if the slot is divisible by 9 without remainder

hybrid spoke
#

9+slot*row

earnest forum
#

if (slot % 9 == 0)

#

9*slot*row

hybrid spoke
#

how did you do that

quiet ice
#

Huh

earnest forum
#

skill

#

hehehehe

#

nah just push backslash before any formatting

#

and it cancels it

hybrid spoke
#

ah

grand perch
#

my head

#

is confused

earnest forum
#

loop through every slot

hybrid spoke
#

so do we now make a twitter bubble against it?

earnest forum
#

check if the slot is divisible by 9

grand perch
earnest forum
#

so a multiple of 9

hybrid spoke
#

?learnjava

undone axleBOT
earnest forum
#

yep

quiet ice
#

Just Loop from 0 to 7

earnest forum
#

^

grand perch
#

no like

#

wouldnt that just

#

put the item on the right?

#

i want it to be on the left right top and bottom

earnest forum
#

no

#

multiple of 9 including 0 is the left

#

and then you also set it to multiple of 9 including 0 + 8

hybrid spoke
#

so either hardcode, or loop through and check for it

earnest forum
#

for the right

quiet ice
#

Oh the actual edges?

#

Like corners

grand perch
earnest forum
#

like summin in the center

hybrid spoke
quiet ice
hybrid spoke
earnest forum
#

if (slot % 9 == 0 || slot == 0) { //this checks if you should put something on the left
   inv.putItem(slot, item);
   inv.putItem(slot + 8, item); // this is for the right
}
grand perch
#

0 to 8

earnest forum
#

slot being the number you're looping

grand perch
#

or...

grand perch
earnest forum
#

thats for left and right

#

then

kindred valley
#

Do you have any advanced gui tutorials

#

Like how can i store something in gui

#

Some players some objects

grand perch
#

also is 9x6 the max inv

trail oriole
#

inv.setItem() ?

trail oriole
earnest forum
#
if (slot >= 0 && slot < 9) { //this is the top row
  inv.putItem(slot, item);
}

if (slot >= 9*5 && slot <= (9*6-1)){ //this is bottom row
  inv.putItem(slot, item);
}
earnest forum
#

54

grand perch
#

bruh i tought it was 56\

earnest forum
#

56

#

is it?

#

no its 54

#

9*6 is 54

kindred valley
earnest forum
#

i dont know if putItem is the proper method

#

i havent actually done spigot in a bit

#

but u get what i mean

trail oriole
#

make a constructor using player head with it's meta and it's name, then setItem()

#

and for items just use setItem

#

works like so inventory.setImem(int, ItemStack)

grand perch
#
        for(int i = 0; i < 54; i++) {

        }
trail oriole
#

the constructor would obviously return an ItemStack

earnest forum
grand perch
#

ok

hybrid spoke
#

corrected now

#

my brain sucks in the morning

earnest forum
#
if (slot % 9 == 0 || slot == 0) { //this checks if you should put something on the left
   inv.setItem(slot, item);
   inv.setItem(slot + 8, item); // this is for the right
} else if ((slot >= 0 && slot < 9) || slot >= 9*5 && slot <= (9*6-1)){ // top or bottom row
   inv.setItem(slot, item);
}
trail oriole
#

How do I add an element to a config ?

earnest forum
#

a list?

trail oriole
#

well i'm making a player kill count and I need to store every player's kill count in my config

#

I tried some stuff but can't get it to work

earnest forum
#

what stuff did u try

hybrid spoke
#

so you get your fileconfiguration and set the value at <uuid>.kills or whatever

trail oriole
#

oh i used player name

earnest forum
#

use uuid

trail oriole
#
@EventHandler
    public void onJoin(PlayerJoinEvent e) {
        Player p = e.getPlayer();
        FileConfiguration cfg = main.getConfig();

        if(!(cfg.contains(p.getName()))) {
            cfg.set(p.getName());
            this.saveConfig();

        } else {
            return;
        }
    }```
#

I have this so far

earnest forum
#

incase they change their name

hybrid spoke
#

you can use that too, but shouldn't

trail oriole
earnest forum
#

well

#

when you set something

#

you have to set it to something

#

you're just giving it where to set it

#

not an actual value

hybrid spoke
#

not sure what contains on FileConfiguration will return

earnest forum
#

cfg.set(p.getUniqueId(), killCount)

hybrid spoke
#

but probably not what you expected

#

also that ^

grand perch
#
Condition 'slot == 0' is always 'false' when reached
earnest forum
#

the loop should start at 0

#

send your code?

hybrid spoke
grand perch
#
        for(int slot = 0; slot < 54; slot++) {
            if (slot % 9 == 0 || slot == 0) { //this checks if you should put something on the left
                inv.setItem(slot, noItem);
                inv.setItem(slot + 8, noItem); // this is for the right
            } else if ((slot >= 0 && slot < 9) || slot >= 9*5 && slot <= (9*6-1)){ // top or bottom row
                inv.setItem(slot, noItem);
            }
        }
earnest forum
hybrid spoke
#

and since you used the || operator the second piece of it will never be reached

earnest forum
#

i forgot about this

grand perch
#

it does start at 0

earnest forum
#

just remove that second part

#

the || slot == 0

hybrid spoke
#

so either change it to | or remove that

grand perch
#

Condition 'slot >= 0' is always 'true'

earnest forum
#

remove that too

trail oriole
#

cfg.set("kills" + p.getName(), killcount); so that would set the player's name into kills right ?

earnest forum
#

add a . after kills

#

and use p.getUniqueId()

grand perch
#

Condition 'slot <= (9*6-1)' is always 'true' when reached
why

trail oriole
earnest forum
#

otherwise you would just have a bunch of lines that say

killsGodCipher: 1
killsYada: 2
killsfrenchkiwi: 3
#

the . makes it a child

#

"kills."+p.getUniqueId().toString()

earnest forum
#

why did i add so much unnecessary checks lool

hybrid spoke
#

set("killsGodCipher", 1000000000000000000000000000)

earnest forum
#

legitimately gained

hybrid spoke
#

obv.

trail oriole
#

doesn't event.getKiller() exist ?

earnest forum
#

no

trail oriole
#

shit how do i do ?

earnest forum
#

you have to get the entity's last damage cause

#

iirc

#

and that gives you another event instance where you can get killer

trail oriole
#

Entity killer = ent.getLastDamageCause().getEntity(); ?

earnest forum
#

no

#

1 sec

trail oriole
#

ent being the killed player

earnest forum
#

it gives you an entity damage event

#

wait

#

i forgot how to do this

#

what event are you using

trail oriole
#
@EventHandler
    public void onDeath(PlayerDeathEvent e) {
        Entity ent = e.getEntity();
        Entity killer = ent.getLastDamageCause().get;

        if(ent instanceof Player && killer instanceof Player) {
            Player p = (Player) e.getEntity();
            Player k = (Player) p.getKiller();

            addKill(k, 1);
        }
    }```
earnest forum
#

brb

#

you can use EntityDamageByEntityEvent

#

it has a e.getDamager()

trail oriole
#

well it's a kill count

earnest forum
#

check if both the entity and damager are players

#

also check if the entity is dead

#

e.getEntity().getHealth() <= 0

trail oriole
#

okay

#
    @EventHandler
    public void onDeath(EntityDamageByEntityEvent e) {
        Entity ent = e.getEntity();
        Entity killer = e.getDamager();
        FileConfiguration cfg = main.getConfig();

        if(ent instanceof Player && killer instanceof Player) {
            if (((Player) ent).getHealth() <=0) {
                int i = cfg.getInt("kills." + killer.getUniqueId());
                cfg.set("kills." + killer.getUniqueId(), i+1);
            }
        }
    }``` would that work ?
earnest forum
#

yeah

#

add toString to the uuids

trail oriole
#

okay

hybrid spoke
#

should be invoked anyways but explicit programming >>

trail oriole
#

what do you mean ?

granite burrow
#

Hey is it possible to have a string like
"&7Te&ast &7string"
but only translate &7 to a color rather than every single color code

#

so the output would be "Te&ast string" with all the words being gray

earnest forum
#

so u want the & in teast to not be colour coded?

grim ice
#

replace

#

&7 with

#

ChatColor.GRAY

#

duh

granite burrow
#

I am actually dumb, I forgot that ChatColor.GRAY gives the color translated already

hybrid spoke
#

doesnt ChatColor.translate... do that?

grim ice
#

if he uses translate it will make

#

it

#

test string

granite burrow
grim ice
#

with everything after the 'e' in test

#

in green

#

since &a

trail oriole
#

use Β§a

grim ice
trail oriole
#

then don't

grim ice
#

using that character is bad practice

#

if spigot somehow misses to translate it

#

itll crash the client or the server

#

one of them or both cant remember

grand perch
#

@earnest forum thx it was what I wanted

hybrid spoke
earnest forum
hybrid spoke
#

spigot itself doesnt translate that

#

Β§ is "hardcoded" into minecraft itself

grand perch
#

Doesn't the client translate that

#

On the Minecraft jar

#

I luytened it once

graceful fiber
#

Can someone help me make a update notifier, so whenever I push an update on Spigot it tells people who have my plugin installed

hybrid spoke
#

?bing

undone axleBOT
hybrid spoke
#

there are many resources with an tutorial

graceful fiber
#

I can't find it

hybrid spoke
graceful fiber
#

oh I didn't search for those keywords

#

ty

trail oriole
hybrid spoke
#

to hit the bong

trail oriole
#

fair

undone axleBOT
graceful fiber
#

Error:

#

I did tho?

#

oh wait yeah i didnt im stupid

#

Yeah so that didn't work, I made a new update and when I reload the plugin(using plugman) it does not show it

hybrid spoke
#

it(the api) updates after ~3 hours

graceful fiber
hybrid spoke
#

depends on the plugin

#

yup

earnest forum
#

yea lmao

#

isnt it basically the same thing

#

but for specific plugins instead of all of them

hybrid spoke
#

it just disable and enables the plugin

#

you shouldnt use that for specific plugins because you could break them with it

earnest forum
#

which is what reload does right

hybrid spoke
#

basically

hybrid spoke
#

spiget maybe, but never really used it

#

nvm. spiget also got the 2* hours gap

#

but github with a custom version file f.e.

#

so a hash sum f.e.?

granite burrow
#

hey just a quick question, for permissions do they have to be initialized on the server to be able to tell if the user has the permission?

~~say I have a permission "test.test1" but that wasn't a permission for any plugin on the server would spigot still output false if the player doesn't have that permission? ~~

I tried it to do something similar in my plugin, using a non declared permission, and I would always get true until I added it into my plugin as a permission.

I'm currently looking up info about it but if any of you know that would be a great help

Edit:
I'm dumb, it was because I was oped

trail oriole
#

I added an else if the player doesn't have any permission, and this one always returns true

#

the others always are false

#

regardless of op, or perms

sage merlin
#

for some reason when i join the server nothing happens in the config

#

oh wait nvm didn't save the config

hybrid spoke
pale crag
#

You know a way to make a player's armor invisible ?

#

So when he get invisibility effect, nobody see him even with armor

#

(i use spigot 1.8.8)

trail oriole
#

cfg.set("players." + p.getUniqueId().toString() + "." + "kills: " , killcount); I have this and i'm not sure what it'll do. The only path in my config.yml is players:, if i'm correct, it'll create a path that goes players: -> player's uuid -> kills -> my variable

trail oriole
pale crag
#

For its damage reduction

#

he can pvp with that

#

Its an effect that give him total invisibility

granite burrow
#

Im a little confused, I am trying to setup a custom chat format however the . I added at the end of the message doesn't line up in the chat with where it says it is in the format

#

%2$s is Minecraft's default message format

pale crag
#

Can you explain more the issue ? I haven't understood

trail oriole
earnest forum
#

hypixel does it

pale crag
earnest forum
#

then again they've got a modified version of the jar

#

forked

pale crag
trail oriole
#

do they even use spigot ?

granite burrow
#

can't you set the players armor level to the same as the armor, then remove the armor until the invisibility wears off?

pale crag
granite burrow
#

or am I brain farting again

earnest forum
#

but then it wouldn't show up as armour for the player

pale crag
earnest forum
#

you could try using nms

granite burrow
pale crag
sage merlin
#

for some reason when i die or when i get killed the killers kill count does not get updated nor does my death count get updated

sage merlin
blissful pumice
#

is the event triggered?

sage merlin
#

yes when i die via getting killed by a player it gets triggered

earnest forum
#

hover over the Killed variable

hybrid spoke
earnest forum
#

is that an error

hybrid spoke
#

first of all, thats not how you handle null

sage merlin
hybrid spoke
#

also you should never catch an NPE

hybrid spoke
earnest forum
#

why are you not printing the stack trace for the error

hybrid spoke
#

second, what is a PlayerDeathCountManager? you just "pass" in a value to directly retrieve it again?

earnest forum
#

usually null pointer exception means theres something wrong

sage merlin
#

if e.getEntity().getKiller() == null is just gonna return null

hybrid spoke
#

you shouldn't even touch it

earnest forum
hybrid spoke
earnest forum
#

nvm

sage merlin
#

if the killer is null

hybrid spoke
sage merlin
#

so i have no way without checking for it being null with it trigereing a NPE

hybrid spoke
#

check it for null, if its null just return

earnest forum
#

after this line

hybrid spoke
#

since you obv. dont want it to continue

earnest forum
#

if (player == null) return;

#

put the death value counter increase above this tho

sage merlin
earnest forum
#

unless you only want death by players

sage merlin
earnest forum
#

because players can die from like fall damage and thats why killers can be null

hybrid spoke
#

?paste

undone axleBOT
sage merlin
earnest forum
#
Player player = e.getEntity().getKiller();
if (player == null) return;
#

simple as this

sage merlin
#

its simple yet its going to cause a NPE

earnest forum
#

how

#

the check is preventing the npe

#

when you use getKiller() that doesnt return an NPE

sage merlin
#

were making a variable before the check

earnest forum
#

only once you use the player variable

#

that will work

hybrid spoke
#

just if you want to invoke something on null a NPE will be thrown

earnest forum
#
Player variable = Bukkit.getPlayer("NotAPlayer"); //no NPE
variable.sendMessage("hi"); // NPE
hybrid spoke
#

because of that

Object obj1 = new Object();
Object obj2 = null;

obj1.equals(obj2); // no NPE - just strictly false
obj2.equals(obj1); // NPE
trail oriole
#
@EventHandler
    public void onJoin(PlayerJoinEvent e) {

        Player p = e.getPlayer();
        FileConfiguration cfg = main.getConfig();
        if  (cfg.contains(p.getUniqueId().toString())) return;
        if(!(cfg.contains(p.getName()))) {
            cfg.set("players." + p.getUniqueId().toString() + "." + "kills: " , killcount);
            cfg.set("players." + p.getUniqueId().toString() + "." + "level: " , level);
            main.saveConfig();
        } else {
            return;
        }
    }``` why won't that work, it doesn't put anything in my config file
sage merlin
#

and also for some reason the death count is not updating in the config

earnest forum
#

isnt it yamlconfiguration?

trail oriole
#

on spigot tutorial it says FileConfiguration

#

but this doesn't create any path in my config

hybrid spoke
sage merlin
hybrid spoke
#

debug it. let it print out the values

trail oriole
#

i have no errors, and my config file is empty pretty much

#

Am I doing something wrong ?

grim ice
#

any design problems? whats ur opinion

#

I know I should make a package for that serializing btw

idle pollen
trail oriole
#

okay lemme try

#

wait

#

when is the config supposed to update ?

#

wait

#

i'm so dumb

#

nevermind

#

how do I use it afterward ?

#

in my server's file, the player is shown properly, but in my ide there's nothing

earnest forum
#

is it working now?

#

has your config updated

trail oriole
#

well in the server files i have ```players:
f0ecb64b-6845-405f-b15b-63dd2439859f:
'kills: ': 0
'level: ': 0

#

but nothing in the ide

earnest forum
#

wdym

#

are you looking at the files from the ide?

idle pollen
# grim ice any design problems? whats ur opinion

I don't know about designing the code.
For me, I would code something that 3-year-later me can still understand where to fix or add new features.
Not really an advice for all cases, but try designing in a way that is comfortable for both you and future you.

earnest forum
#

they aren't gonna update lol

trail oriole
#

ide

earnest forum
#

yes they aren't gonna update ahahaha

trail oriole
#

i'm so confused

earnest forum
#

those aren't connected to the server

trail oriole
#

if i modify it, won't it reset the old one in the server

earnest forum
#

they shouldn't be updating

trail oriole
#

and delete everything the old one had ?

earnest forum
#

if the file already exists in the folder it will not

#

only if the file doesn't exist it will create a new one that has everything you put in there

trail oriole
#

i'm confused but i think i got it

earnest forum
#

those are just placeholders

#

now when you wanna update them

#

do you want it to be player kills only?

#

if you want it like that you can listen to player death event

trail oriole
#

i need to use the kills from the config to update the level in the config too

#

like every 25 kills, add 1 level

earnest forum
#

yea so whenever you change it

#

check if the kills are divisible by 25 and if yes add another level

trail oriole
#

So i don't need the config file in my ide

#

like i never use it

earnest forum
#
@EventHandler
public void playerDeath(PlayerDeathEvent e) {
  Player victim = e.getEntity();
  if (e.getEntity().getKiller() instanceof Player) {
    Player killer = e.getEntity().getKiller();
    ConfigurationSection playerSection = cfg.getConfigurationSection("players."+killer.getUniqueId().toString()); // get player's data section
    if (playerSection.get("kills")+1 % 25 == 0) { //if divisible by 25 add a level
      playerSection.set("level", playerSection.get("level")+1); // add level
    }
    playerSection.set("kills", playerSection.get("kills")+1); //increase kill counter
    
  }


}
earnest forum
trail oriole
#

wait

earnest forum
#

no wait

#

keep it in your project

#

otherwise it won't create the file

trail oriole
#

you told me not to use getKiller() earlier

earnest forum
#

yes i didnt realise this was a thing lmao

#

sorry

#

you were doing e.getKiller()

trail oriole
#

well it isn't lmao

earnest forum
#

this is e.getEntity().getKiller()

#

it should work

#

let me know if it doesn't tho

trail oriole
#

well

#
    @EventHandler
    public void onDeath(EntityDamageByEntityEvent e) {
        Entity ent = e.getEntity();
        Entity killer = e.getDamager();
        if (ent == killer) return;
        FileConfiguration cfg = main.getConfig();

        if(ent instanceof Player && killer instanceof Player) {
            if (((Player) ent).getHealth() <=0) {
                int i = cfg.getInt("players." + killer.getUniqueId().toString() + "." + "kills");
                cfg.set("players." + killer.getUniqueId().toString() + "." + "kills", i+1);
                i = cfg.getInt("players." + killer.getUniqueId().toString() + "." + "kills");
                if (i % 2==0){
                    int lv = cfg.getInt("players." + killer.getUniqueId().toString() + "." + "level");
                    cfg.set("players." + killer.getUniqueId().toString() + "." + "level", lv+1);
                }
                main.saveConfig();
            }
        }
    }``` I used this
#

should I change ?

earnest forum
#

this is unnecessary

#

just do +".level"

#

but yea thats good

trail oriole
#

oh okay

earnest forum
#

you dont need to convert the entity to player to get its health as well

trail oriole
#

it casted automatically

sinful tundra
#

Is it possible to get an ItemStack by a uuid?

trail oriole
#

what do you mean ?

sinful tundra
#

Every item has a unique ID

#

Now, I'm using the event HangingBreakEvent, however, I don't know how to get the broken hanging item

harsh totem
#

What slot in a player's inventory is the off hand?

#

Like the number of it in an array of inventory.getContents()

trail oriole
crude loom
#

If I display a scoreboard to a player, then reset it and set different values to it, and display it to another player, will it show them both the same values?

hybrid spoke
#

but you could use the PDC

sinful tundra
#

What do you mean?

hybrid spoke
#

?pdc

sinful tundra
#

tried it

#

Whenever I have the hanging entity it doesn't show the persistent data container I've put

hybrid spoke
#

you can convert an item to an itemstack

sinful tundra
#

Even a hanging one?

sinful tundra
#

I'll check it out, thanks!

hybrid spoke
#

πŸ‘

crude loom
#

I mean, when you reset a scoreboard, does it show the updates to the player?

hybrid spoke
#

if you update it for the player

#

then yes

crude loom
#

so I have to use the player.setScoreboard() for him to see it?

earnest forum
#

or scores

#

yea

sinful tundra
royal kindle
#

Hi

#

how can i set horse owner and give it armor?

#

after spawn

rocky bolt
#

Guys can someone tell me why i get this errors in console every minut

quiet ice
#

Can horses even have owners?

royal kindle
sinful tundra
rocky bolt
rocky bolt
sinful tundra
#

In the code itself

rocky bolt
#

Not 1k but large amount

sinful tundra
#

Like your actual code

hybrid spoke
#

like the words you wrote

trail oriole
#

any help ?

hybrid spoke
#
12.05 13:11:02 [Server] INFO java.lang.NullPointerException: null
12.05 13:11:02 [Server] INFO at fr.purpleyounoob.kiwipvp.killCount.<init>(killCount.java:23) ~[?:?]
12.05 13:11:02 [Server] INFO at fr.purpleyounoob.kiwipvp.Kiwipvp.onEnable(Kiwipvp.java:28) ~[?:?]
sinful tundra
#

Can you post your code from there myb we can help more?

trail oriole
#

which class

sinful tundra
#

KillCount

#

Line 23 specifically

trail oriole
#

FileConfiguration cfg = main.getConfig();

hybrid spoke
#

so main is null

sinful tundra
#

nice, what is main?

trail oriole
#
public killCount(Kiwipvp kiwipvp) {
        this.main = kiwipvp;
    }```
eternal night
#

how are you initializing it

trail oriole
#

getServer().getPluginManager().registerEvents(new killCount(this), this);

hybrid spoke
#

?conventions

undone axleBOT
trail oriole
#

saveDefaultConfig();

eternal night
#

is that the entire constructor πŸ€”

trail oriole
#

main class

sinful tundra
#

Do you see the file in your server files?

trail oriole
#

yes

eternal night
#

I have doubts

trail oriole
#

on ?

hybrid spoke
#

you

eternal night
#

show is the fields

trail oriole
hybrid spoke
#

just paste the entire class

eternal night
#

FileConfiguration cfg = main.getConfig(); this is a field isn't it

sinful tundra
#

Can you send the whole KillCount class?

eternal night
#

:/

sinful tundra
#

?paste

hybrid spoke
#

?paste

undone axleBOT
sinful tundra
#

oops

trail oriole
eternal night
#

yea, they just define FileConfiguration cfg = main.getConfig(); as a field

#

you cannot do that

#

java will initialize the fields before the constructor

trail oriole
#

what is a field ? πŸ˜…

eternal night
#

hmm ?

sinful tundra
#

Wait

#

Bruh

eternal night
#

your "class variable"

hybrid spoke
#

?learnjava huh

undone axleBOT
grim ice
undone axleBOT
kindred valley
river oracle
hybrid spoke
kindred valley
#

This person belongs here

#

For print method

quiet ice
#

!

kindred valley
#

What is the most important server difference between spigot and modding

quiet ice
#

There is None in a technical sense

eternal night
#

I mean, craftbukkit has a lot of changes to vanilla

kindred valley
#

But spigots different.

quiet ice
#

The real killer is paper however

river oracle
#

Spigot is all server sided

#

Forge is both client and sevrt sided so you can add new materials etc

kindred valley
#

Harder than server

quiet ice
#

Spigot is a Mod If you are pedantric. Plugins could also be considered mods I guess

#

And Well that concludes the discussion

kindred valley
#

Would it be possible if i want to make a client just addingn the client side automatical mod path?

quiet ice
#

Both Forge and spigot are recompile-based. Fabric & Sponge are ASM-based, but that is only a difference in specific implemenations of moddings

#

As someone that's is modding another Game that is written in Java from Scratch I can say that modding without a Toolchain is super hard If you lack the proper experience

#

It also Takes enormous amounts of dedication (i.e. 3+ years) to do

hybrid spoke
quiet ice
#

Still a mod

hybrid spoke
#

you dont really modify anything with it

quiet ice
#

Many mods only use the Forge API, does that mean that they are Not mods?

hybrid spoke
#

what does that matter?

quiet ice
#

If you Go by that Logic only Forge, SpongeVanilla, Bukkit and Fabric are mods

#

But really Plugins can already modify the game behaviour enough to be worthy of that title

hybrid spoke
#

thats not some sort of logic, thats what it is. spigot IS the interface to CraftBukkit

kind hatch
#

Isn’t that the case though? If you look at it more closely, spigot is the mod, plugins people make are the extensions of the parent mod.

#

Hence the name plugins

hybrid spoke
#

you dont modify minecraft, do you?

quiet ice
kind hatch
#

Not with forge no.

quiet ice
#

Spigot-api is

kind hatch
#

If we want to go pedantic, isn’t spigot more akin to a wrapper?

hybrid spoke
quiet ice
hybrid spoke
#

thats what an api is.

#

back to the topic

you dont modify minecraft, do you?

quiet ice
#

I do modify it yes

hybrid spoke
#

how do you modify minecraft itself with spigot/plugins?

crimson terrace
#

and any plugin is a wrapper of a wrapper?

hybrid spoke
#

all you do is sending packets and manipulate the way/which packet is sent

#

you dont do anything directly to minecraft

quiet ice
#

The game behaviour itself (even If the jar/class files are Not) are altered

quiet ice
hybrid spoke
#

mods actually modify the game, not just manipulate the game behaviour

quiet ice
#

The fact that something was added to a registry does Not Change this fact

quiet ice
#

The real differnce between mods and Plugins is Just how we Name it

hybrid spoke
#

okay, so, the ensuing discussion after this statement depends entirely on whether we pick out the definitions now and look for gaps, or whether we debate our disagreements until we come to overlaps.

trail oriole
#
if (!(Bukkit.getOnlinePlayers().contains(args[0]))) {

                }```would that work to check if the arg of a command is a player ?
blissful pumice
#

no

#

you need to cast args[0] to a player first

#

and chack if it exists\

eternal oxide
#

Not cast

#

if (Bukkit.getPlayerExact(args[0] != null)

trail oriole
#

thanks !

blissful pumice
#

Player p = Bukkit.getPlayer(args[0]);

if(p == null){
sender.sendMessage("that is not a player!")
return true;
}

#

if you want to send the sender a message

trail oriole
#

don't worry I got the rest

#

thanks a lot guys

#

some help ? πŸ˜…

hybrid spoke
#
12.05 14:27:19 [Server] INFO Caused by: java.lang.NullPointerException
12.05 14:27:19 [Server] INFO at fr.purpleyounoob.kiwipvp.kiwiListener.onDmg(kiwiListener.java:299) ~[?:?]
trail oriole
#

Well i know

#

but i don't see the error

hybrid spoke
#

well, something on line 299 in kiwiListener is null obv.

trail oriole
#
    @EventHandler
    public void onDmg(EntityDamageByEntityEvent event) {
        if (!(event.getEntity() instanceof Player)) return;
        Player damaged = (Player) event.getEntity();
        Player damager = (Player) event.getDamager();

        if (damager.getItemInHand() == null) return;

        ItemStack w = damager.getItemInHand();
        if (w.getItemMeta().getDisplayName().equalsIgnoreCase("Withered dagger")) {
            damaged.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 40, 2));
        }
    }```
#

if (w.getItemMeta().getDisplayName().equalsIgnoreCase("Withered dagger")) {

eternal oxide
#

which line is 299?

eternal oxide
#

lots in there can be null

#

meta can be null

trail oriole
#

but i'm checking before if player has an item in hand

#

and i have the error when hitting without any items too

eternal oxide
#

w can be null, as can getItemMeta

trail oriole
#

w can't be null