#help-development

1 messages ยท Page 1844 of 1

torn shuttle
#

hold up, does setting permissions not persist through player relogs?

worldly steppe
#

please help me with the error

wraith apex
#

You'll have to show us the error here if we are going to be able to help you

worldly steppe
#

i send

wraith apex
#

We can't help if you don't show us the error

worldly steppe
#

.

#

thats the config

wraith apex
#

Yup we got that

wet breach
torn shuttle
#

I thought it was stored by the server

wraith apex
#

Nah

#

You gotta use a permissions plugin

#

like say LuckPerms

wet breach
dark arrow
#

How will I make the interface

wraith apex
#

Oh

#

No the server doesn't store permissions

#

it can check

wet breach
#

there is api methods to set permissions stuff on player objects

dark arrow
wet breach
#

if the player relogs and you didn't store what you had set, it goes away ๐Ÿ™‚

hasty prawn
#

It doesn't, it's probably checking for clicking and moving

torn shuttle
#

I can't guarantee that my users will use luckperms, I'll have to dump the perms into the database and set on every login

dark arrow
#

i am new to plugin devlopment

torn shuttle
#

why is nothing ever easy

hasty prawn
#

Obviously in the case of chests and stuff it can know, but not their inventory

worldly steppe
#

@wraith apex please tell me the error in the config

wraith apex
wet breach
#

if you really need to know when a player has their inventory open

#

listen for a an inventory click event

hasty prawn
#

^

wet breach
#

then check the inventory window to see if it is their inventory

hasty prawn
#

That obviously won't be able to tell when it's closed though Sadge

wet breach
hasty prawn
#

It does? confusedCat

wet breach
#

yep

#

not sure why it sends that but not an open inventory packet XD

hasty prawn
#

Then why doesn't it notify when it opens smh

#

Mojang blushimcBonk

wraith apex
#

you have not provided an error message

#

you have only provided a config

worldly steppe
#

but i dont know the error

hasty prawn
#

...?

#

What's not working then

worldly steppe
#

thats console

wraith apex
#

ah

#

if you throw your config into a YAML parser it gives you a better answer

worldly steppe
#

i do it

#

but i still dont know

wet breach
#

@worldly steppe toss your file into a yaml parser. specifically this file modalidades.yml somewhere in that file near name: "&e&lSKYWARS" there is something wrong with its format. Odds you probably have a tab in there. Yaml hates tabs and instead need to use spaces.

#

or maybe a bracket is missing

worldly steppe
#

but please tell me the error

wet breach
#

I did

wraith apex
#

did not find expected key while parsing a block mapping at line 16 column 9

worldly steppe
#

i see it like 1 hour and i dont know exactly the error

wet breach
#

Well can you show the file then?

worldly steppe
#

can u send a keyยฟ?

wet breach
#

?paste

undone axleBOT
worldly steppe
#

im spanish

#

i dont know whats key

#

srry

wet breach
#

can you go to that link, and paste the contents of that file it has issues with?

worldly steppe
#

an key symbol

eternal oxide
#

indentation is VERY important with yaml

wet breach
#

then send us the link here

wraith apex
#

@wet breach

#

this is his config

worldly steppe
wraith apex
#

it will be an indentation error

#

or like frost said

#

tabs and spaces in the same file

dark arrow
worldly steppe
#

im spanish, i dont know some worlds

wraith apex
#
   This
      Is
         Indentation
worldly steppe
#

oh ok

wraith apex
#

all the whitespace between your text and left-most area of the text file

dark arrow
#

lets goo

dark arrow
worldly steppe
#

and where is the identation? and what i do? i add 2 spaces, delete one, add 4?

dark arrow
#

now i can get the player cords

worldly steppe
wraith apex
#

For starters I'm noticing you're missing a quote mark "

#

and the error is not always useful as it will point to where it failed to parse not necessary where the problem is

wet breach
#

beat me to it when I was looking

wraith apex
#

YAML still reports its borked

dark arrow
#

how to send msg to a player if he does a specific event?

worldly steppe
#

ok, i add the quotes

wraith apex
#

hangs at line 41

wet breach
worldly steppe
#

what happens at line 41?

wraith apex
wet breach
wraith apex
#

ah

dark arrow
#

ok thx

worldly steppe
wraith apex
#

๐Ÿ‘

#

brb

dark arrow
#

ohh once a i fetch the player data i can get so many things of that player

worldly steppe
#

how i made in lore spaces for ejample

#

example*

#

hello, how are you
(space)
players :1

#

how i put an space?

#

i resolve bymyself

#

np

wet breach
#

glad you solved it on your own ๐Ÿ™‚

dark arrow
#

1 mrore thing to ask that how will i give nbt tag to the mob that i spawned

worldly steppe
#

@wraith apex

#

can u send me an symbol that is an arrow?

#

like that

#

โ†’

#

that can be used on ansi

#

please

#

one similar symbol

mellow gulch
#

->

grim ice
#

why is my Scoreboard team null when it actually exists

#

i register it onEnable and access it by manager.getTeam(name);

#

but its null

acoustic pendant
#

hey, for some reason, this isn't executing when i change the item in the hotbar

#

it is registered

chrome beacon
chrome beacon
#

Do you know what it does

grim ice
#

wait i think I know why LMO

#

1s

acoustic pendant
chrome beacon
#

No

#

It triggers when you change the main hand in client settings

acoustic pendant
#

oh

acoustic pendant
chrome beacon
#

Yeah the PlayerItemHeldEvent

acoustic pendant
#

thanks!

chrome beacon
#

I highly recommend you read the javadocs :)

acoustic pendant
#

yea... i thought that was the correct

wraith apex
#

Entities have a PersistantDataContainer that you can access and store data in

#

This also goes for ItemStacks and Chunks

young knoll
#

And tile entities

wraith apex
#

^

#

Are tile entities not a subset of entities?

young knoll
#

Eh

#

Iโ€™m pretty sure they are handled entirely differently

wraith apex
#

because all entities have this feature

#

Oh I think you mean TileState

young knoll
#

Yes

#

I think Mojang actually calls them Block Entities now

hybrid spoke
#

did you register the event?

wraith apex
#

getPlayer()

hybrid spoke
#

mark the method as eventhandler?

#

or do you want to have the player who wrote the message?

wraith apex
#
public void onChat(AsyncPlayerChatEvent e)
{
    e.getPlayer();
}
#

oh like a private message system

#

do you have a command to send a message to someone?

#

like /msg ?

hybrid spoke
#

then you would have to split the string at " " and search for a name

wraith apex
#

Ah

grim ice
#

why are team prefixes not showing up at all

hybrid spoke
#

as i said, split the message and look for a name

grim ice
#

ill send code in a min

wraith apex
#
e.getMessage().contains("playerNameHere");
grim ice
#

scoreboard.getTeam("the").setPrefix("why");

#

prefix doesnt show

#

i checked and the player is in the team

#

wait

wraith apex
#
if(e.getMessage().contains("playerNameHere"))
{
    // Notify player    
    Bukkit.getPlayer("playerNameHere").playSound();
}
grim ice
#

how do i add a player to a team in the first place

acoustic pendant
#

Hey! for some reason, the sout("2") isn't executing any time and sout("1") is only executing when i have the item but i change to other slot, could anyone help me?

grim ice
#

im adding the player uuid..

wraith apex
grim ice
#

yes

#

but what he heck is the argument im supposed to pass

#

the uuid as a string or the playern ame

wraith apex
#

player name

#

or uuid

#

anything to reference the player

grim ice
#

still doesnt show

wraith apex
#

what are you trying to get to show?

grim ice
#

sorting players in tab

wraith apex
#

I think the prefix only shows above the players head

#

to get something like a prefix working in tab you will probably need to register an objective

grim ice
#

wut

#

WAIT I THINK I KNOW WHY

#

ITS A THEORY BUT ITS PROB CUZ IM USING getNewScoreboard

#

instead of getMainScoreboard

#

nope

#

that isnt why

wraith apex
#

I mean main scoreboard is just the scoreboard that is normally used in Minecraft

#

new scoreboard is just a fake scoreboard tracked by the server

#

it will disappear when you do a restart

grim ice
#

eitherway

#

how do i make the prefix show

spiral light
#

isnt there a setPrefix in Scoreboard#Teams ?

wraith apex
#

I imagine through NMS

wraith apex
#

not for the tab list

grim ice
#

nah

#

it shows in tablist for other ppl in forums

spiral light
#

well you can completly remove players from tablist and create your own players for tab and set their names to set a prefix ^^

wraith apex
#

true

#

oh yeah so it does

#

Aight

#
Team t = s.registerNewTeam("someTeam");
t.addEntry(player.getName());
t.setPrefix("A Prefix");
junior geyser
#

Is it possible to force an iron golem to target a player without NMS?

spiral light
#

entity#setTarget

junior geyser
#

I believe I tried that, but I don't think that works with iron golems

spiral light
#

without a loop it would be possible to set a Target and once the EntityTargetLivingEntityEvent calls you can cancel and set new

junior geyser
#

I can double check that tho

spiral light
junior geyser
wraith apex
#

Then make it mad :)

spiral light
#

if you spawn it and setTarget it probably untargets because it has no reason to target a player idk

spiral light
junior geyser
#

Ok thanks I'll play around

marble granite
#

Can someone tell me where the default ChunkGenerators in spigot are located for the world, nether and end? i can't seem to find them

wraith apex
grim ice
#

i am in the 'a' one

wraith apex
grim ice
#

main

spiral light
wraith apex
#

are you even able to see yourself in tab?

grim ice
marble granite
spiral light
#

yeah... its a bit difficulty but what do you want to do ?

marble granite
#

i need to see how they did it

spiral light
marble granite
#

hm

#

right

acoustic pendant
#

Hey! for some reason, the sout("2") isn't executing any time and sout("1") is only executing when i have the item but i change to other slot, could anyone help me?

marble granite
#

i need to make the default generator not generate after a certain amount of blocks, and i want that as optimized as possible

marble granite
#

so i guess i want to see how minecraft does it in order to replicate it with ChunkGenerator

glossy venture
#

is there a place where i can find the whole spigot server with dependencies

chrome beacon
#

Just run build tools?

buoyant viper
glossy venture
#

ohk

#

forgot abt that

wraith apex
#

Aight

grim ice
#

uh

acoustic pendant
wraith apex
#
Player p = Bukkit.getOnlinePlayers().iterator().next();
ScoreboardManager sm = Bukkit.getScoreboardManager();
Scoreboard s = sm.getMainScoreboard();
Team t = s.registerNewTeam("someTeam");
t.addEntry(p.getName());
t.setPrefix("A Prefix");
buoyant viper
grim ice
#

what version is it tho

wraith apex
#

This code works for me

#

1.17

grim ice
#

im using 1.8

spiral light
wraith apex
#

I'm not sure what black magic md_5 pulled then during the different versions haha

spiral light
spiral light
wraith apex
spiral light
#

yes

wraith apex
grim ice
#

bro many servers use 1.8

#

and they have it

#

UHH

spiral light
#

with packets mostly yes

wraith apex
#

^

grim ice
#

scoreboards exist in 1.8 tho

#

u dont need packets

spiral light
#

did you try vanilla achieve this behavior ?

grim ice
#

no

#

idk how

spiral light
#

^^

glossy venture
wraith apex
glossy venture
#
Caused by: java.io.IOException: Could not rename file <plugin>\CraftBukkit\._LGPL.txt7194590323968921571.tmp to <plugin>\Cra
ftBukkit\LGPL.txt
        at org.eclipse.jgit.util.FileUtils.rename(FileUtils.java:323)
        at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1514)
acoustic pendant
#

i mean, i have the item in the hand, and executes sout("2") then i change to other and sout("1")

buoyant viper
glossy venture
buoyant viper
#

ur on java 17?

marble granite
spiral light
glossy venture
#

is that the problem

buoyant viper
#

possibly, i think 1.18+ requires java 17

acoustic pendant
#

in PlayerItemHeldEvent

wraith apex
#

yees

#

1.18+ wants Java 17

spiral light
glossy venture
buoyant viper
#

also not sure if --rev latest gets 1.18.1 instead of 1.17.1 yet, idk

glossy venture
#

ah

spiral light
wet breach
#

think it does

buoyant viper
#

hope it does

wet breach
#

however I always specify version anyways

buoyant viper
#

same

acoustic pendant
wet breach
#

also, Java 17 is standard now?

acoustic pendant
wraith apex
#

Java 17 is an LTS version

buoyant viper
#

^

spiral light
wraith apex
#

so hopefully we will not be moving versions again

#

LTS = long term support

buoyant viper
#

not for a couple years at least

wraith apex
#

more than a few years I'd hope haha

wet breach
wraith apex
#

I hate moving Java versions

glossy venture
#

still throws the error with jdk 17.0.1 64 bit on windows

wraith apex
buoyant viper
#

seeing how quickly J10+ came out, i think we could see the next LTS be something around J20-22/23

wraith apex
#

Oracle wanting to release a new version of Java every 6 months

#

:/

#

why tho

mighty sparrow
#

To keep it updated

#

Big Brain

marble granite
spiral light
buoyant viper
#

just because it worked doesnt mean it was a good choice ๐Ÿ˜ž

mighty sparrow
#

Yes

spiral light
buoyant viper
#

java 11+ features were really nice for development and mc not supporting them or requiring a backport-y method of doing it was meh

marble granite
#

i guess i could pregen the world

wraith apex
#

I'm still going to give people a glare if they use var

buoyant viper
#

not to mention j8 streams were crappy, lord knows if theyve been improved though

wraith apex
#

Go back to web development :p

buoyant viper
wraith apex
#

oof why

buoyant viper
#

less words i gotta type

wraith apex
#

just creates ambiguity

wraith apex
buoyant viper
#

bold of u to assume thats not already the case

wraith apex
#

I mean sure with variable names yeah

#

possibly

#

but at least you knew the type

#

var a, var b, var c means nothing

wet breach
#

I should start on that PR for spigot to make use of unix sockets ๐Ÿ™‚

buoyant viper
#

u can tell the type from the right side of the assignment too tho?

lean gull
#

any way of making each player have their own world on my server without taking a ton of storage, memory and causing lag?

wraith apex
wet breach
spiral light
wet breach
#

it is doable as I have made such a system before, just not easy

eternal oxide
#

there was a plugin called "personal worlds". Look it up and update it

wet breach
#

or you can do single server with multiple words

#

but generally not going to end well

lean gull
#

servers like hypixel have this, is there a way to make it with less resources?

wraith apex
#

Hypixel have their own 'realms'

lean gull
wraith apex
#

like Minecraft

buoyant viper
#

idk other languages get away just fine with inferred types

#

like csharp and cpp, hell even rust has it i think

lean gull
lean gull
spiral light
wet breach
wraith apex
#

Hypixel apparently gives you the ability to have your own server nested inside itself

ivory sleet
wraith apex
#

instead of going to a provider like pebblehost

#

and buying your own

lean gull
wraith apex
#

you rent from hypixel instead

grim ice
#

its free if u have a rank

lean gull
#

?

#

im using minehut

wet breach
#

first off, what you are asking will require an entirely custom solution server wise. Hypixel has custom server jar's that work with their hardware/software that controls when it should add more server or remove servers.

wraith apex
#

Personal worlds wise, I'd turn off spawn chunks because no point loading spawn chunks for individual worlds for each player

#

esp if the world is only 300x300

wet breach
#

as I said, this is doable, just not something that can be created over night

ivory sleet
#

Anyways the way hypixel has it is fairly advanced and sophisticated, they use redis and rabbitmq iirc along with both worlds and different servers with proxies and a super proxy so yeah itโ€™s a bit hard to emulate them to the letter

wraith apex
#

it's not that difficult to do

lean gull
#

i just used hypixel as an example, not trying to recreate or use their system

wet breach
lean gull
#

im just 1 basic boi

wet breach
#

or if you want to ignore all security as well

wraith apex
#

Well I mean the infrastructure to move people to their worlds and create them

lean gull
#

i dont know a lot of java nor spigot

ivory sleet
#

Something like that over a night is prone to bugs

lean gull
#

so how could one achieve this?

wraith apex
#

across 1 server & multiple worlds? or multiple servers and multiple worlds?

lean gull
#

btw, the max players count is 500

spiral light
# lean gull so how could one achieve this?

i think this can be answered with:
if you want to know how your probably not good enought for this.... if you know how to do this, you would not just ask "how to do this?"

wraith apex
#

You can teleport players to different worlds

wet breach
# lean gull 1 server, multiple worlds

then to answer your question on resource consumption there is really no way to reduce it then if you go with this method without using some kind of custom server jar

buoyant viper
wraith apex
#

using the teleport method in Player

spiral light
#

then try to create 500 worlds and see what happens

wraith apex
#

multiverse is bloat and overkill for this

ivory sleet
wraith apex
#

Bukkit has a class called WorldCreator

#

which you can use to create said worlds

#

unless you plan to have a default template

#

then you can just have a world that you can copy

lean gull
wraith apex
#

yees

wet breach
#

well I answered the best I could, I am going to go make some food now >>

spiral light
wet breach
#

I don't recommend attempting this as a new person to spigot and java

acoustic pendant
ivory sleet
#

WorldCreator will create a normal world which is probably not the most optimized thing if youโ€™re looking for resource optimizations

lean gull
spiral light
#

@ivory sleet i am not sure but the api inits the World-Spawn-Chunks.... a pr for this could be usefull to reduce generation lagg :?

ivory sleet
#

Elaborate

wet breach
#

oh someone else who hasn't look at the code yet >>

#

good luck XD

ivory sleet
#

๐Ÿฅฒ

lean gull
#

what code

wet breach
#

that was towards FreeSoccer

lean gull
#

oh

wet breach
#

they say a PR could be made to reduce generation lag

#

and this is true, but the reason this isn't happening is because of the code ๐Ÿ˜›

lean gull
#

whats pr

wet breach
#

pull request

lean gull
#

wat

wet breach
#

its part of git

buoyant viper
#

a request to spigotmc to change their code

spiral light
lean gull
#

you talkin big brain words to me

#

i dont understand

runic mesa
#

Whats the best way to change a block in a 10x10 area around a player

#

including 10 up and 10 down

#

I want to make all diamonds stone when a player gets close

buoyant viper
#

when u make a (P)ull (R)equest to a project u ask someone to update their code to something possibly more efficient or useful

wet breach
runic mesa
#

mhm

#

well not all

#

specific

wet breach
#

now do know that is an uneven square

lean gull
#

wouldnt it be 20x20x20

#

he said 10 up, 10 down

wet breach
lean gull
#

ye but he said including which implies that its for all directions

wet breach
#

well that is what I was going to ask

#

is it 10 completely across or 10 from the starting point

spiral light
lean gull
#

oh wait no

wet breach
lean gull
#

he said 10x10 and then including

ivory sleet
runic mesa
spiral light
wet breach
lean gull
#

or an anti xray

runic mesa
ivory sleet
wet breach
#

a bounding box is your solution

spiral light
wet breach
#

bounding box will let you know if a player attempts to modify a block in a defined area ๐Ÿ™‚

spiral light
ivory sleet
#

Yeah basically an AABB which stores a min point and a max point

runic mesa
wet breach
spiral light
wet breach
# runic mesa Can you explain a bounding box a bit more?

bounding box uses the upper left corner or right, and lower left or right. So if you go with upper right, then lower left is the opposite. Once you have those you know all the coordinates in that box because of math(its not super hard) and you can easily check from the events if a particular block is in that bounding box. Good news is the spigot api has a method for bounding box

wet breach
#

that just puts the level spawn in memory which isn't that large

ivory sleet
#

So guaranteed something else will get influenced by that (and potentially broken)

spiral light
wet breach
#

There are a number of other stuff generation wise other then the initial spawn

spiral light
wet breach
ivory sleet
#

For you that is

#

I assume you didnโ€™t write any particular unit or functional tests to prove it tho

spiral light
wet breach
#

or done some extreme stability tests to identify if it changed something elsewhere XD

ivory sleet
#

Yeah

ivory sleet
wet breach
#

like the code for the generator stuff was a complete mess and was hard even for some of the dev's that I consider better then myself

#

XD

spiral light
wet breach
#

now despite what I might be saying don't let it discourage you from attempting anything

#

just know that its not a matter of a so called simple pr is all

wraith apex
#

I mean that's what it sounds like

#

found this on reddit

wet breach
#

well not quite the same context lol

ivory sleet
#

Truth be told, itโ€™s unsurprisingly accurate

spiral light
wet breach
#

I don't think we were talking about API, rather implementation

lean gull
#

back, so it it possible to make a basic plugin for this?

acoustic pendant
#
public boolean getNewSlot(boolean similar) {
        return this.getNewSlot(similar);
    }

    @EventHandler
    public void playerHand(PlayerItemHeldEvent e) {
        SQLGetter shortn = MineSpaceSkills.getInstance().data;
        Player player = e.getPlayer();
        System.out.println("0");
        if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
            System.out.println("0.5");
           // if (player.getInventory().getItemInMainHand().getItemMeta().equals(ItemManager.warp.getItemMeta())) {
            if (getNewSlot(player.getInventory().getItemInMainHand().isSimilar(ItemManager.warp))){
                System.out.println("1");
                Telequisword.put(player, ItemManager.warp);
                shortn.addDamage(player.getUniqueId(), 25);
                shortn.addStrength(player.getUniqueId(), 125);
                shortn.addChanceDamage(player.getUniqueId(), 65);
            } else {
                System.out.println("2");
                if (Telequisword.containsKey(player)) {
                    shortn.addChanceDamage(player.getUniqueId(), -65);
                    shortn.addDamage(player.getUniqueId(), -25);
                    shortn.addStrength(player.getUniqueId(), -125);
                    Telequisword.remove(player);
                }
            }
        }
    }
}```

Hey! i tried to do this since i was getting errors with sout("1") but now i got spammed with more errors
#

รง

spiral light
wet breach
spiral light
acoustic pendant
spiral light
#

you should learn java if you dont see this or at least know how to use the API

ivory sleet
#

Yeah that function calls itself uncontrolled finitely many times

runic mesa
#

or in my case all diamonds in the bounding box

ivory sleet
#

Loop through every block in the AABB

#

And set the material

wet breach
#

^

#

you already have the coordinates

#

which is all you need to change a block at that spot

stone sinew
# wraith apex

md_5 to everyone trying to change a shit ton of blocks at the same time. lmfao

wet breach
#

its actually easy to change a ton of blocks at the same time

#

just a lot of people simply don't do it because they don't know how ๐Ÿ™‚

stone sinew
wet breach
#

nope

stone sinew
#

yeap

wet breach
#

not using the server is faster

stone sinew
wet breach
#

but I am not

stone sinew
#

But thats the context.

lean gull
#

would 10gb of ram would even be enough to host a maximum of 500 players? i doubt i'll even get close to it, but still

stone sinew
#

Say what you're talking about if you want to say it was faster lol

lean gull
#

500 worlds*

wet breach
#

the fastest way you could change a ton of blocks is by simply modifying the region file directly

wet breach
#

don't know how fawe does whatever it does

stone sinew
#

Only problem with that is the packets need to be sent.

spiral light
wet breach
#

then server takes care of that for you ๐Ÿ™‚

stone sinew
wet breach
stone sinew
#

I like watching something just appear lmfao

wet breach
#

well when you load a chunk

#

the server takes care of the packets for you

lean gull
spiral light
#

no

lean gull
#

oh ok

#

how much is good then

#

like whats the maximum of worlds and players i should have

wet breach
#

10GB is technically all you need

#

however, the problem with hosting 500 players isn't just ram or cpu

stone sinew
wet breach
#

there is just game mechanics that will get in the way of being able to do this

spiral light
stone sinew
ivory sleet
lean gull
#

im usin a server host so i dont really have a lot of info, nor do i understand it

ivory sleet
#

But on spigot, yes

spiral light
ivory sleet
#

Yaa

stone sinew
#

3 worlds with 1 player and all plugin data takes about 2 gb

runic mesa
wet breach
spiral light
#

my server takes 5GB with a bigger overworld then default.... (probably because of 2220 chunks and 14k tile-entities)

stone sinew
lean gull
#

honestly i just want players' plots to be at 0,0 lol

ivory sleet
stone sinew
#

Or if you're good with math you can just get all the coords that way ๐Ÿ˜‰

wet breach
#

bitshifting for the win

#

anyways. the solutions are above ๐Ÿ™‚

grim ice
#

how do i translate color codes into colors

#

like &

#

IK chatcolor.whatever

#

i mean

#

in

#

scoreboard teams prefix

wet breach
#

translateAlternateColorCodes()

stone sinew
spiral light
grim ice
#

even in scoreboard teams prefixes?

wet breach
#

o.O

#

bitshifting is a process o.o

#

so like int a = 1000 <<< 7;

spiral light
#

i made and small tool that reads the region files of a world and creates images (biome, height, block-textures) with it ... a pain for my brain to get the data for each block with just 43 longs as input and 10 block states for example

wet breach
#

so that shifts in binary, 1000 to the left 7 times

spiral light
#

i know how to use bits probably but its not that simple to understand (mostly how mojang saves worlds is hard to understand)

wet breach
#

1000 = 1111101000 in binary, now we shift 7 places to the left 11111010000000000 = 128000

#

that is bitshifting

spiral light
#

and i still dont know why you tell me this ^^

wet breach
#

because you responded to my comment about bitshifting and what you said didn't really relate to that XD

#

so I explained bitshifting

spiral light
#

๐Ÿ˜„ ok miss understand ^ just wanted to say its not easy to read smth that is saved in bits if you dont know how they saved it as bits

wet breach
#

that is why you use NBT library ๐Ÿ™‚

spiral light
#

i believe there is nothing that tells you out of a long for 16x16x16 blocks the biome for each and also the blockstate

wet breach
wet breach
#

even outdated information is still useful

spiral light
#

not that much but yes it was

wet breach
#

also not everything in MC always changes in every update, especially in regards to Region file format ๐Ÿ™‚

spiral light
#

in 1.18 they changed how chunks / regions / sections and their biomes are saved since biomes are 3D now

wet breach
#

yep, didn't change too drastically though

prime reef
#

You can't put plugin-based libraries in Maven Central, correct?

#

since it requires standalone releases

paper viper
#

you can?

#

like inventory framework belongs on there

wet breach
paper viper
#

when i make my libraries i usually dont extend pluginbase or anything

#

i just force the user to pass in an instance of their plugin

#

XD

wet breach
#

Well, extending PluginBase lets your library exist in the plugin directory without the server complaining

wet breach
#

they essentially have to take care of all that ๐Ÿ™‚

ivory sleet
prime reef
#

tbf

#

it handles a few things ingame as well

wet breach
#

then not entirely sure, I don't really know the rules of maven central off hand since I have no reason to use it

prime reef
#

a bit how like EffectLib is a library but also a plugin

#

yeah i'll look into it more

ivory sleet
timid kraken
#

hey does Bukkit#getPlayer return offline players aswell?

wraith apex
#

Bukkit.getOfflinePlayer

ivory sleet
#

Technically an instance of Player is an instance of OfflinePlayer

#

since Player derives OfflinePlayer

#

But yeah the player must be present on said server if the return should be non null

timid kraken
#

i just want a method that can give me a player object regardless of them being offline or online

ivory sleet
#

Yeah then go with LogicalDarkโ€™s method

#

However should be said, if he player has never joined before the name of the OfflinePlayer instance will be null

timid kraken
#

ok so the player has to have atleast joined the server once, got it

ivory sleet
#

Yeah given that the cache hasnโ€™t been touched in some odd way

#

(Nothing you should worry about fyi :))

timid kraken
#

ok, thanks a lot!

wet breach
#

not overly difficult to get such things from Mojang API

#

generally handy if all you have is player name because API wise you need the UUID

quaint mantle
#

how to make in Bungeecord chat, a "button"?

On click in "accept", etc

sterile token
#

Hi! Any http library for uploading multiple files via POST?

paper viper
#

if you are using newer java versions

#

they have a built in HttpClient

#

which is very good

sterile token
#

I always use java 1.8

paper viper
#

:/

sterile token
#

Its a minecraft plugin

paper viper
#

are you using 1.8 api

#

bruh

sterile token
#

So i cannot use another version. Because server thrown that im using a recent version of compiled plugin

paper viper
#

what is your server version then?

sterile token
#

1.8.8

buoyant viper
#

rip

#

maybe apache httpclient could suffice then

paper viper
#

this is why we hate 1.8 users

#

lol

sterile token
#

Why hate 1.8 users? Click spaming its the better thing that has be done by minecraft

paper viper
#

lol

buoyant viper
#

bc its old as fuk

sterile token
#

I have break like 3 mouse because of jitter click

spiral light
paper viper
#

the new combat update actually allows you to use ur damn brain instead of clicking as fast as you can

#

im glad my fingers still exist

#

Lol

buoyant viper
#

the new combat is nice until u got a full hunger bar and regening in like 3 microseconds

#

and then it drags the fight on

spiral light
paper viper
#

on the smps i play people are super sweaty and use crystals

#

so it doesnt matter

#

Lol

buoyant viper
#

shields are also an issue of their own blocking 100% of damage but

paper viper
#

axes disable them tho anyways

buoyant viper
#

yeah

sterile token
#

1.17x its good before you see that lot of minigames go to the trush

paper viper
#

so you'd be completely useless

#

and no protection

buoyant viper
#

but i still wish they were just damage reduction rather than invulnerability

paper viper
#

nah id take invulnerability

#

beating hard mode with skeletons without a shield that blocks arrows

buoyant viper
#

maybe for arrows id like invuln

paper viper
#

but even creepers

#

and stuff

buoyant viper
#

if u want realistic shield then the 100% block makes sense but ๐Ÿ˜ฆ it just seems too op in most circumstances

sterile token
#

Finally i could do the artifact upload to my webserver (via file://webserver-path) and then using it as maven dependency. Now im working for doing the same but getting the artifacts and deploying them via http

sacred mountain
#

anyone know how to decompile and recompile after editing class files? I need to change some of a plugins features from 1.9-1.8 IDs

sacred mountain
#

i have intellij ide

#

how would i do it? could you talk me through it

sterile token
#

Right. First download a decompiler i use JD-GUI. Then you should check if its maven project (its easier to recompile it) but if it isnt a maven project you should manually look for the project dependencies.

#

The JD-GUI will give you a .zip that its the source itself. But keep in mind that if the plugin its obfuscated then i dont know

#

if you have questions only do it

chrome beacon
#

I recommend using Recaf

halcyon shuttle
#

yo guys any idea on why is spigot highlighting commandexecutor and changing it to executor? package me.Stephen.FirstPlugin.commands;

import me.Stephen.FirstPlugin.Main;

import org.bukkit.command.CommandExecutor;

public class HelloCommand implements CommandExecutor {

private Main plugin;

public HelloCommand(Main plugin){
    this.plugin = plugin;
}

}

sterile token
#

Oh lol

#

So if use that u can remove obfuscated plugin license request?

halcyon shuttle
buoyant viper
sterile token
quaint mantle
#

how to use ClickEvent.Action.RUN_COMMAND in bungeecord

halcyon shuttle
#

how to do that? im literally just following youtube tutorial

quaint mantle
#

a

sterile token
halcyon shuttle
#

you mean those lightbulbs on the left?

buoyant viper
#

sure

sterile token
#

Yeah there you should see the posible solutions

#

One will say implement class methods

#

Or smt hlike that

halcyon shuttle
#

there are two and none says anything like that unfortuantly, it reccomends to change comandexecutor to just exectutor but perhaps thats not what i want

#

or im just blind and increlibly dumb at the same time idk

kind hatch
#

If anyone here has worked with maven multi modules, please join the thread titled Issues with Maven Multi Modules. Could really use some help with it.

sterile token
sterile token
halcyon shuttle
#

i think so, i added spigot 1.18.1

kind hatch
halcyon shuttle
#

actually it highlights whole org.bukkit.command

wet breach
#

that is after so many sustained attacks, the shield breaks

buoyant viper
paper viper
wet breach
vague swallow
#

Where do I have to put the overworld.json in a 1.18 datapack?

timid kraken
#

is it possible to get a player's IP address?

ivory sleet
#

Yup

timid kraken
#

what's the method for it?

ivory sleet
#

getAddress iirc

timid kraken
#

thanks!

low temple
#

What is the most efficient way to save data from a plug-in? Is it efficient to create a single Data class, store all relevant into that class, then serialize the object created from that class into a file?

unreal quartz
#

use a database

warm mica
kind hatch
#

Most efficient way is a database like MySQL or MongoDB. The easiest way would be YAML files.

patent horizon
#

how can i grab a random block

kind hatch
#

From the world? In a specific location?

patent horizon
#

no just

#

any random block

chrome beacon
#

Block (in the world) or material

warm mica
# patent horizon any random block

I want to remind you that picking a random block in the whole world causes possibly the chunk to get generated or loaded and that possibly causes lag

kind hatch
low temple
unreal quartz
#

sqlite

low temple
#

Aight thanks Iโ€™ll look into it

warm mica
#

You can communicate with both very similar, you don't have to change a lot within your code

wet breach
kind hatch
low temple
#

I see, thank you sm guys

ivory sleet
#

DAO - data access repository, basically the encapsulated Map

patent horizon
unreal quartz
#

dude just wanted to know where to save data lol

ivory sleet
#

DTO - data access object, basically the java data class representation of whatever you want to handle.

patent horizon
#

awesome

warm mica
#

All existing Materials are already predefined within an Enum

buoyant viper
#

?jd my beloved

mighty sparrow
#

?jd paper

mighty sparrow
#

Jk

cold field
#

I've finally made it XD. A lib that exposes brigadier compatible from 1.8.8 to 1.17.1

#

If anyone would like to review my code I would really appreciate it

quaint mantle
#

What would the 1.12 equivilent of "PlayerCommandSendEvent" be?

ivory sleet
#

Thereโ€™s the PlayerCommandPreProcessEvent

ivory sleet
#

@cold field (:

cold field
#

Uhh thanks

ivory sleet
#

Do you want a review concerning api or just code architecture and infrastructure generally as well as if I find anything I think you should change because there are better alternatives?

cold field
#

Code architecture and any suggestion is welcome

ivory sleet
#

Want me to go all in or just the most fundamental?

cold field
#

Choose you, I don't want to put too much work or problems on you

ivory sleet
#

Oh no worries Iโ€™m fine, I like to review code (:

#

Well first of all Iโ€™d suggest getting familiar with the kotlin dsl (as opposed to groovy dsl)

#

Packages are all lower name

#

So thisIsWrong

#

thisisright or this.is.right

#

The dot hints a nested package

cold field
#

Ok, I'm going to change it right now

ivory sleet
#

Also, all variables should come before any methods

#

class A {
B b;

void c(){}

D d;
}
This is bad

class A{
B b;
D d;

void c(){}
}
This is good

#

Should be said that constructors also come between the variables and the methods, so in the middle

#

Static fields/variables should come before instance variables/normal fields

#

Static methods should come before instance/normal methods

#

The utility class is not a utility class

#

Rather a helper class

#

A utility class must only contain stateless methods and constant variables such that no mutations happen, you know when you have a utility class due to this reason:

Given the same input, you will always get the same output no matter what methods or data is manipulated or called before or after

#

?paste

undone axleBOT
ivory sleet
#

Empee generally I think youโ€™re using static too much

cold field
#

XD

ivory sleet
#

of course static is fine

#

But thing is

vague swallow
#

Hello guys, can someone please help me? For some reason this is not working

Main main;

public int getInt(UUID id) {return main.getConfig().getInt("Player." + id + ".Int");}

public String Att(UUID id) {
  String a = "[Admin]";
  String b = "[Player]";

  if(getInt(id) == 0) {
    return a;
  } else return b;
}

@EventHandler
public void Chat(AsyncPlayerChatEvent e) {
  e.setFormat(Att(e.getPlayer().getUniqueId()) + e.getPlayer().getDisplayName() + e.getMessage());
}
ivory sleet
#

Itโ€™s excruciating to deal with when doing concurrency and multithreading as you donโ€™t really have a way of controlling when theyโ€™re initialized as well as due to their global state

#

so yeah arguably try to get rid of it by using proper instances

#

static is good, but itโ€™s often misused

#

Should be said static init blocks should be declared under the static variables imo

vague swallow
cold field
#

Mh ok. When is it good to use? For instance I used static to save reflection field. Is it ok?

ivory sleet
#

Also avoid variables with names_like_this prefer thisTypeOfNameThoFineForSomethibtLikeV1_8_R3

ivory sleet
#

You seem to be using it a lot more than just that

#

But itโ€™s good that youโ€™re caching reflective objects

#

Also disambiguate the name Main in your implementation source

#

Call it something more relevant in regards to your libraryโ€™s functionality

cold field
#

I couldn't think something better XD

#

I will work on it

ivory sleet
#

Yeah well that was it, Iโ€™ll come back to you once youโ€™ve yeeted your static singletons and made your design more object oriented

#

But if you want to become more educated in architecture, learn SOLID, testing (Unit tests and try out TDD), learn the design patterns also.

hasty prawn
#

Ooooh can I also attend Conclure school wuv_u

unreal quartz
#

10k tuition fee

hasty prawn
wet breach
#

that is on the cheap side to be honest

#

well by US standards anyways

unreal quartz
#

oh i forgot to mention

#

per week

hasty prawn
#

I'm dropping out

cold field
ivory sleet
#

@hasty prawn
That static state can be troublesome especially if you wanna use it in a concurrent environment or something else. Create a CommandCollector class maybe? And for the command map, have a class which separately provides the instance, your XCommand looks like it could change for different significant reasons thus breaking single responsibility principle to some extent. Also Iโ€™d argue for that you should initialize all of your instance variables in your constructor. Like either initialize em all outside or inside, it can be quite complicated when you do it in both places, especially if the class grows.

#

This CommandAPI class felt like it could be a utility where if you need to store state create a class for it

unreal quartz
#

my guy doing code reviews at half 1 in the morning on christmas day

ivory sleet
#

Also the static there could possibly be extracted into some CommandManager or PluginCommandHandler

#

This function looks copy pasted and the suppress warning lol. Well regardless Iโ€™d say that you should extract smaller functions (can be done with IntelliJ > Refactor > Extract Method) as big functions like this are considered rude to the reader.

cold field
hasty prawn
#

I just haven't updated it lmao

ivory sleet
#

Ah

#

The ItemBuilder is cool

#

Altho arguably a little superfluous as it doesnโ€™t follow the builder pattern convention which is that mainly immutable objects should have builders tho I understand why people create those still (:

hasty prawn
#

Because they're cool NODDERS

ivory sleet
#

The static map there could be extracted out to its own class like for instance PlayerScoreboardCacheRepository

#

Also maybe make all the listeners separate classes where they contain the name Listener, as I think of classes with API in them to be interfaces

hasty prawn
#

So basically anytime I'm storing a static list of things, use a separate class for that? Thonk

ivory sleet
#

Just a bit counter intuitive imo

#

Yes basically thatโ€™d be something to look after

#

Because then you can test it

#

And you can easily adapt it into a multithreaded environment

#

And you can create abstractions

hasty prawn
#

Hmm alright

vague swallow
#

Guys can someone please help me? For some reason this is not working

Main main;

public int getInt(UUID id) {return main.getConfig().getInt("Player." + id + ".Int");}

public String Att(UUID id) {
  String a = "[Admin]";
  String b = "[Player]";

  if(getInt(id) == 0) {
    return a;
  } else return b;
}

@EventHandler
public void Chat(AsyncPlayerChatEvent e) {
  e.setFormat(Att(e.getPlayer().getUniqueId()) + e.getPlayer().getDisplayName() + e.getMessage());
}
hasty prawn
#

What's not working

ivory sleet
#

All your BlahAPI classes gives me the vision of an interface but instead itโ€™s a listener class, I just think you should extract out listener logic to a separate class due to the fact that listeners are really low level in a code infrastructure

#

And also

vague swallow
ivory sleet
#

Listeners are allowed to have static singletons

vague swallow
#

And it's not setting my prefixes

hasty prawn
ivory sleet
#

๐Ÿฅฒ

#

Are there any particular class you want me to look at? But itโ€™s quite nice lib

hasty prawn
#

I think I have have had it listening, separated them out, and then forgot to remove the implements afterwards

#

that made no sense

ivory sleet
#

yeah, like Iโ€™d say use kotlin dsl but thatโ€™s merely preference.

hasty prawn
#

So basically, stop using static Lists/Maps lol

ivory sleet
#

Dessie to point out some good things
You use gradle
You have for the most have good and reasonably long methods
You have made your library very modular which makes it easy for users to grab only what they need

#

Ya

hasty prawn
#

Gradle angy

ivory sleet
#

Like thing is that code mostly doesnโ€™t need much comments because you mostly succeeded to explain yourself in code

hasty prawn
#

I have fought that stupid thing constantly, fantastic when it works, makes me want to die when it doesn't.

ivory sleet
#

๐Ÿฅฒ

hasty prawn
#

Yeah I'm not really great with comments but I try

ivory sleet
#

No donโ€™t

#

Each comment represents a failure of expressing your code

candid galleon
#

comments explain why

ivory sleet
#

Nothing can be as good as a good comment, but a bad comment can be worse than bad code

hasty prawn
#

Interesting

#

Okay so not terrible I'll take it LOL

ivory sleet
#

Yeah, above average spigot dev

#

Almost enterprise danceDog

hasty prawn
#

It's hard to not use static because it's easy hypixel_sad

ivory sleet
#

Yeah sadly

vague swallow
hasty prawn
#

oh my god almost 4000 lines

ivory sleet
#

Send the error darth mango

cold field
#

can I use _ on package names? Otherwise If it is a multiple words name it's difficult to read it ๐Ÿ˜ซ

candid galleon
#

please no

ivory sleet
#

^

cold field
#

๐Ÿ˜ข

ivory sleet
#

empee the package structure has a convention apart from its naming convention

#

you start with your domain but reversed

candid galleon
#

ugly af ifs

ivory sleet
gleaming grove
#

hi how can i get all server commands?

hybrid spoke
#

just.split.your.package.names

ivory sleet
#

and then every package in your reverse domain packages should be ONE word which in ABSTRACT TERMS explain the content of the package @cold field

cold field
#

Oh

#

I see

ivory sleet
#

sometimes two words

vague swallow
# ivory sleet Send the error darth mango

[01:23:26 ERROR]: Could not pass event AsyncPlayerChatEvent to StarWarsEssentials v1.0-SNAPSHOT
java.lang.NullPointerException: null
at starwarsessentials.starwarsessentials.chats.test.getInt(test.java:14) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Att(test.java:20) ~[?:?]
at starwarsessentials.starwarsessentials.chats.test.Chat(test.java:27) ~[?:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor63.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.16.5.jar:git-Paper-579]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:76) ~[patched_1.16.5.jar:git-Paper-579]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.16.5.jar:git-Paper-579]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:607) ~[patched_1.16.5.jar:git-Paper-579]

ivory sleet
#

Like itโ€™s just a convention

vague swallow
#

at io.papermc.paper.adventure.ChatProcessor.post(ChatProcessor.java:222) ~[patched_1.16.5.jar:git-Paper-579]
at io.papermc.paper.adventure.ChatProcessor.processingLegacyFirst(ChatProcessor.java:102) ~[patched_1.16.5.jar:git-Paper-579]
at io.papermc.paper.adventure.ChatProcessor.process(ChatProcessor.java:60) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.chat(PlayerConnection.java:2085) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:2000) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1938) ~[patched_1.16.5.jar:git-Paper-579]
at net.minecraft.server.v1_16_R3.PacketPlayInChat$1.run(PacketPlayInChat.java:43) ~[patched_1.16.5.jar:git-Paper-579]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_311]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_311]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_311]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_311]
[01:23:26 INFO]: <Darth_Mango> hi

candid galleon
#

?

#

?paste

undone axleBOT
candid galleon
#

please don't butt in a conversation with just an error log

ivory sleet
#

Paper sus

candid galleon
#

it's pretty disrespectful

vague swallow
candid galleon
#

go ask the paper discord

ivory sleet
candid galleon
#

allman style is cringe

hasty prawn
#

should be the noman style since no one should use it

candid galleon
#

makes code so much longer

ivory sleet
vague swallow
#

@ivory sleet So Doc? What's my problem?

hasty prawn
#

Alright I'll work on cleaning up my static use, ty for the feedback Conclure hannahxxLuv

ivory sleet
#

Hope you found it useful (:

cold field
candid galleon
#

@ivory sleet would you be able to review my code? ๐Ÿ‘€

candid galleon
#

all package names are always lowercase

#

xyz.msws.plugin.managers.command for example

hasty prawn
#

Command_manager obviously

ivory sleet
#

is commandmanager a necessary name? manager specifically

candid galleon
#

semi-big plugin, feel free to look at what you want

ivory sleet
#

Good code since the functions are small however, I feel like this should be in a ModuleManager or ModuleRepository or ModuleCache or smtng since your derivative of JavaPlugin should change for one major reason, and that is if the bootstrap of your plugin is changed. However if thereโ€™s a change to your module system implementation your JavaPlugin derivative might be influenced by this change.

#

Good that you extracted this method, it could be extracted a little bit more (:

#

A little bit concerned about the mutability of the Enum instances here, probably fine but yeah Iโ€™d probably have something like a TranslationManager which encapsulates a Map<Lang,String> or smtng to handle loading separately maybe?

#

Your module system is good

#

The LoudoutManager looks good altho you sometimes do:
if (cond)
do();

Which I usually avoid since it visually degrades the scope.

candid galleon
#

do you usually do

if(cond) {
  do();
}

?

ivory sleet
#

Yeah

candid galleon
#

gotcha

ivory sleet
#

Nice Attribute abstraction also

#

Same with the Selector infrastructure

#

Also really good that you got a proper utility class ingot_diamond

candid galleon
#

:D thanks for the compliments

candid galleon
ivory sleet
#

Hmm yeah, since spigot is mostly single threaded and since most devs around spigot donโ€™t write tests, the design is not something most are influenced by.

cyan dock
#

04:04:44 [INFO] Loaded plugin TCPShield version 2.5.5 by https://tcpshield.com
04:04:44 [INFO] Loaded plugin cmd_server version git:cmd_server:1.18-R0.1-SNAPSHOT:b4ccdaa:1625 by SpigotMC
04:04:44 [INFO] Loaded plugin cmd_alert version git:cmd_alert:1.18-R0.1-SNAPSHOT:b4ccdaa:1625 by SpigotMC
04:04:44 [INFO] Loaded plugin BungeeGuard version 1.2-SNAPSHOT by Luck
04:04:44 [INFO] Loaded plugin cmd_send version git:cmd_send:1.18-R0.1-SNAPSHOT:b4ccdaa:1625 by SpigotMC
04:04:44 [INFO] Loaded plugin cmd_list version git:cmd_list:1.18-R0.1-SNAPSHOT:b4ccdaa:1625 by SpigotMC
04:04:44 [SEVERE] Exception in thread "main"
04:04:44 [SEVERE] java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
04:04:44 [SEVERE] at net.md_5.bungee.conf.YamlConfig.getServers(YamlConfig.java:224)
04:04:44 [SEVERE] at net.md_5.bungee.conf.Configuration.loadServers(Configuration.java:136)
04:04:44 [SEVERE] at net.md_5.bungee.conf.Configuration.load(Configuration.java:110)
04:04:44 [SEVERE] at net.md_5.bungee.BungeeCord.start(BungeeCord.java:296)
04:04:44 [SEVERE] at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:49)
04:04:44 [SEVERE] at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)

wet breach
#

@cyan dock can you please not spam everywhere

cyan dock
#

Okay

#

Sorry

wet breach
#

just because no one is responding in #help-server doesn't make it ok, it simply means people are busy with other things and just going to have to patiently wait

#

just how it is for the free support ๐Ÿ™‚

#

keep in mind, half the world right now it is Christmas for them

#

the other half its christmas eve

cyan dock
#

Hah, I understand

formal bear
#

how to get string from other class?? i have Player player = (Player) sender; but i cant use it in other class where i for example display name of item "botprzemek's item"

candid galleon
#

?di

undone axleBOT
wet breach
candid galleon
#

how would you go about it?

wet breach
candid galleon
#

how would you grab the object instance?

wet breach
#

singletons are a thing

ivory sleet
#

Well arenโ€™t you just speaking of static singletons which is basically static?

wet breach
#

public class Something {
private Something instance;

private Something(){
    instance = this;
}

public Something(){}


public static Something getInstance() {
    if(instance == null) {
        instance = new Something();
      }
      return instance;
}
ivory sleet
#

Yeah lazy static singleton

wet breach
ivory sleet
#

If you donโ€™t use static youโ€™d have to inject one or another way

wet breach
#

but in either case you don't strictly need the main class reference to get information from another class

ivory sleet
#

Apart from using something like reflection or guice

gleaming grove
#

Guys do you know why my "testcommand" has been register like this "testcommand:testcommand"?

cold field
#

@ivory sleet I've made the changes that you told me. I'm unsure about the static. I've removed only two var from static. The other things are for caching reflection or builder used for backward compability

wet breach
ivory sleet
cold field
#

Thanks. I will do it

#

Thanks a lot, really

ivory sleet
#

If their string is in a different class and you cannot use static, then only solution is injection

cold field
#

I'm going to sleep. Bye bye

ivory sleet
#

Might not be explicit

wet breach
#

well lets say the class object is just basically a custom array object, as long as a reference to it is stored you can obtain the string, or you can have methods to link 2 classes together too

ivory sleet
#

But it will have to be injected one or another way

ivory sleet
wet breach
ivory sleet
#

Iโ€™m not talking about a main class

#

Iโ€™m just saying that if you do not have the choice to use static, then there must be an injection somewhere

wet breach
#

you can create the object of another class in the class you want the string in.

#

new object(); now anything that goes on in that object is accessible in the class you wanted the string. it really just depends how you need it done really XD

ivory sleet
#

Yes but then itโ€™s not in a different component theoretically if youโ€™d do that, I mean given a dependency you must inject it, if you just instantiate an instance of a class within said class it is not a dependency then.

#

At least not what Iโ€™d define as a dependency

wet breach
#

I think the point I am saying, is why would they need to be dependencies of each other or one depend on another for either one to access the objects of one or the other

ivory sleet
#

Hmm yeah thatโ€™s probably a good question

formal bear
#

im confused rn ๐Ÿ’€

wet breach
#

yeah, try saying that sentence 5 times fast

#

probably won't go very well XD

gleaming grove
#

ye i'm so curious that why dependency injections libraries are not that popular in Spigot development comunnity

ivory sleet
#

I mean

#

Spigot isnโ€™t overly engineered which makes normal explicit dependency injection not a pain

#

Itโ€™s a java 7-8 stylish api

#

not enterprise api directly ๐Ÿ˜…

#

Though personally I use guice for my highest level components, even in spigot.

wet breach